Order of invocation of constructor and destructor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siya12
    New Member
    • Mar 2010
    • 2

    Order of invocation of constructor and destructor

    How do i show the order of invocation of constructor and destructor?
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    Usually the constructor/s, then the copy constructor/s and and finally the destructor appear at the top of the public: section of the class.

    Comment

    • siya12
      New Member
      • Mar 2010
      • 2

      #3
      sir can you send me the program which include the answer of this question,the question is 'show the order of invocation of constructor and destructor' please help me quick.

      Comment

      • whodgson
        Contributor
        • Jan 2007
        • 542

        #4
        for example:
        Code:
        class Cat
        {  
          public:
           Cat();//constructor
           Cat(Cat&);//copy constructor
           ~Cat();//destructor;
           //more methods here
          private:
           //private data and methods
        };

        Comment

        Working...