Write a program for hybrid inheritance using constructor and destructor
Answers
Answer:
Constructors and Destructors In inheritance
Constructors and Destructors In inheritanceIt is very interesting for the curious learner to know whether constructors and destructors also inherited parent class to child class or not
Constructors and Destructors In inheritanceIt is very interesting for the curious learner to know whether constructors and destructors also inherited parent class to child class or notWhen we are using the constructors and destructors in the inheritance, parent class constructors and destructors are accessible to the child class hence when we create an object for the child class, constructors and destructors of both parent and child class get executed
Constructors and Destructors In inheritanceIt is very interesting for the curious learner to know whether constructors and destructors also inherited parent class to child class or notWhen we are using the constructors and destructors in the inheritance, parent class constructors and destructors are accessible to the child class hence when we create an object for the child class, constructors and destructors of both parent and child class get executed
Explanation:
- hope its help you
Answer:
Base class constructors are called first and the derived class constructors are called next in single inheritance. Destructor is called in reverse sequence of constructor invocation i.e. The destructor of the derived class is called first and the destructor of the base is called next.
Explanation: