Why is it so that we can have virtual constructors but we
cannot have virtual destructors?
Answer Posted / rdl
We can have Virtual Destructor. We cannot have virtual
constructor, becoz, if the constructor is virtual, in
polymorphism, there may be a chance for the base class
constructor not to get executed. so the entire class will
not be available.
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
What is polymorphism what is it for and how is it used?
How is class defined?
What does no cap mean?
Why do we use class?
What is destructor example?
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
Is abstract thinking intelligence?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
What is polymorphism and types?
Where is pseudocode used?
What is encapsulation process?
Why polymorphism is used in oops?
What is abstraction with example?
What is the difference between static polymorphism and dynamic polymorphism?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?