Show the output of the following code.
```
#include
using namespace std;
class Parent
{
public:
Parent()
{
cout << "Parent’s no-arg constructor is invoked" << endl;
}
~Parent()
{
cout << "Parent’s destructor is invoked" << endl;
}
};
class Child: public Parent
{
public:
Child()
{
cout << "Child’s no-arg constructor is invoked" << endl;
}
~Child()
{
cout << "Child’s destructor is invoked" << endl;
}
};
int main()
{
Child c1;
Child c2;
return 0;
}
```
Parent’s no-arg constructor is invoked
Child’s no-arg constructor is invoked
Parent’s no-arg constructor is invoked
Child’s no-arg constructor is invoked
Child’s destructor is invoked
Parent’s destructor is invoked
Child’s destructor is invoked
Parent’s destructor is invoked
You might also like to view...
Of the classes below, the one that is most likely to be declared abstract is _________________.
a) Bat b) Squirrel c) Animal d) Iguana e) Parrot
What is a standard library?
A. A library created by the programmer. B. Libraries included as part of the C++ language. C. Libraries that include blueprints of classes. D. There are no standard libraries.