Why is it so that we can have virtual constructors but we
cannot have virtual destructors?
Answer Posted / sachinmundhra
vptr gets initialize in constructor. So in that case we
cannot have virtual constructor.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is the difference between encapsulation and polymorphism?
Why do we use class?
what is different between oops and c++
What are the three main types of variables?
What is the problem with multiple inheritance?
How Do you Code Composition and Aggregation in C++ ?
what are the realtime excercises in C++?
What is the fundamental idea of oop?
What are the important components of cohesion?
What is overloading and its types?
What are functions in oop?
What polymorphism means?
Whats is abstraction in oops?
explain sub-type and sub class? atleast u have differ it into 4 points?
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.