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
Describe these concepts: Polymorphism, Inheritance and Abstraction.
#include
Can destructor be overloaded?
What is destructor oops?
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
What is byval and byref? What are differences between them?
What is the difference between encapsulation and polymorphism?
Why multiple inheritance is not possible?
Why oops is important?
Explain virtual inheritance?
What is the difference between abstraction and polymorphism?
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
What are properties in oop?
What is encapsulation in oops?