fork download
#include <iostream>
using namespace std;

class Base
{
public:
   Base()
   {
      cout << "Base()\n";
   }

   Base(int)
   {
      cout << "Base(int)\n";
   }

   ~Base()
   {
      cout << "~Base()\n";
   }

   Base& operator=(int)
   {
      cout << "Base::operator=(int)\n";
      return *this;
   }
};

class Derived : public Base
{
public:
   Derived()
   {
      cout << "Derived()\n";
   }

   Derived(int n) : Base(n)
   {
      cout << "Derived(int)\n";
   }

   ~Derived()
   {
      cout << "~Derived()\n";
   }
};

class Holder
{
public:
   Holder(int n)
   {
      member = n;
   }

   Derived member;
};

int main(int argc, char* argv[])
{
   cout << "Start\n";
   Holder obj(1);
   cout << "Finish\n";

   return 0;
}
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Start
Base()
Derived()
Base(int)
Derived(int)
~Derived()
~Base()
Finish
~Derived()
~Base()