C++ Programming - Objects and Classes - Discussion
Discussion Forum : Objects and Classes - General Questions (Q.No. 3)
3.
Which of the following statement is correct regarding destructor of base class?
Discussion:
15 comments Page 2 of 2.
Nagnath said:
1 decade ago
Because the initialization of base class objects must not be destroyed by deleting object of derived class. That is base class destructor must not be called upon calling derived class destructor.
Abhishek Singh said:
1 decade ago
If object of derived class is created, then constructor of derived class is called automatically, and if base class constructor has same name, then it is called also.
Same scenario will be happened if Destructor of base class is not virtual.
so it should always be virtual.
Same scenario will be happened if Destructor of base class is not virtual.
so it should always be virtual.
Abhishek Singh said:
1 decade ago
If object of derived class is created, then constructor of derived class is called automatically, and if base class constructor has same name, then it is called also.
Same scenario will be happened if Destructor of base class is not virtual.
Same scenario will be happened if Destructor of base class is not virtual.
Naseem asraf said:
1 decade ago
Because the initialization of base class objects must not be destroyed by deleting object of derived class. That is base class destructor must not be called upon calling derived class destructor.
Ashish said:
1 decade ago
Because the initialization of base class objects must not be destroyed by deleting object of derived class. That is base class destructor must not be called upon calling derived class destructor.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers