In c++ there is only virtual destructors, no constructors. Why?
Answer Posted / uma sankar pradhan
constructors are invoked at the time of object creation.
The v-table for virtual function mechanism is not
intialised properly during the constructor invocation.
So constructors cannot be virtual
But,destructors can be virtual.Because the V-table is
properly initialised at the time of object creation.
So the v-table is available for the destructors.
Destructors can be made pure virtual also.But unlike other
member functions,it must be redfined outside the class.
| Is This Answer Correct ? | 57 Yes | 22 No |
Post New Answer View All Answers
Give an example where we have to specifically use C programming language and C++ programming language cannot be used?
What is polymorphism and why is it important?
What are main features of oop?
Why do we use class?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
Is oop better than procedural?
What makes a language oop?
what is graphics
What is an advantage of polymorphism?
What are the types of abstraction?
Why do we need polymorphism in c#?
What are oops methods?
Why do we use encapsulation in oops?
Why is oop better than procedural?
hi all..i want to know oops concepts clearly can any1 explain??