Answer Posted / nk
There is nothing like virtual constructors but we can have
virtual destructors so that the destructor of the correct
object is called.
Ex.
Base *bptr = new derived()
delete bptr; then the destructor of the derived objetc is
called when the base destructor is marked as virtual.
else destructore of base class is called and may lead to
memory leak if we have allocated any new memory.
Is This Answer Correct ? | 18 Yes | 1 No |
Post New Answer View All Answers
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
What is overriding vs overloading?
Can you name some types of inheritance?
What is the difference between abstraction and polymorphism?
can inline function declare in private part of class?
what are the different types of qualifier in java?
What is solid in oops?
What is data binding in oops?
What is an interface in oop?
how to get the oracle certification? send me the answer
What is constructor in oop?
What is the main feature of oop?
IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?
What is abstraction and encapsulation?
Get me a number puzzle game-program