topical media & game development

talk show tell print

professional-program-10-ConstructorChain-ConstructorChain.c

? / professional-program-10-ConstructorChain-ConstructorChain.c


  include <iostream>
  
  using namespace std;
  
  class Something
  {
  public:
    Something() { cout << "2"; }
    virtual ~Something() { cout << "2"; }
  };
  
  class Parent
  {
  public:
    Parent() { cout << "1"; }
    virtual ~Parent() { cout << "1"; }
  };
  
  class Child : public Parent
  {
  public:
    Child() { cout << "3"; }
    virtual ~Child() { cout << "3"; }
  
  protected:
    Something mDataMember;
  };
  
  int main(int argc, char** argv)
  {
    Child myChild;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.