Answer to Question #239533 in C++ for unique

Question #239533

Consider following code and state the order of execution constructors and order

of execution of destructors.

class C: public A, virtual public B

{ public:

C( ):A( ),B( )

{

cout<<”c class constructor”;

}

};


1
Expert's answer
2021-09-22T03:48:18-0400
class C: public A, virtual public B
{ public:
C( ):A( ),B( )
{
cout<<"c class constructor";
}
};
/*
Answer:
A constructor is a special type of class method that is automatically called
 when an object of the same class is created.
In this code snippet, no class objects have been created. 
Consequently, no constructors or destructors will be called.
*/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS