Answer Posted / suresh.k (portblair)
Using virtual destructors, you can destroy objects without
knowing their type - the correct destructor for the object
is invoked using the virtual function mechanism. Note that
destructors can also be declared as pure virtual functions
for abstract classes.
if someone will derive from your class, and if someone will
say "new Derived", where "Derived" is derived from your
class, and if someone will say delete p, where the actual
object's type is "Derived" but the pointer p's type is your
class.
| Is This Answer Correct ? | 2 Yes | 4 No |
Post New Answer View All Answers
What is the diamond problem in inheritance?
Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.
What is coupling in oops?
What is encapsulation with example?
What is overriding in oops?
What is the difference between a constructor and a destructor?
What is destructor in oop?
2. Give the different notations for the class.\
What is class and example?
What is abstract class in oops?
Why do we use class in oops?
when to use 'mutable' keyword and when to use 'const cast' in c++
What are the 3 principles of oop?
Whats is abstraction in oops?
How do you answer polymorphism?