Hi everbody!
Can anyone proper explain me the concept of virtual constructor and virtual distructor.
I will be very thankful if explained with the help of example...
Thanks
Bhagwat
Printable View
Hi everbody!
Can anyone proper explain me the concept of virtual constructor and virtual distructor.
I will be very thankful if explained with the help of example...
Thanks
Bhagwat
The simplest difference is a virtual constructor doesn't exist.
A virtual destructor does.
In general, if your class is going to be the parent of any child class, you NEED a virtual destructor. Just put "virtual" before the destructor.
There's technically no such thing as a virtual constructor in C++. I'd suggest reading: http://www.parashift.com/c++-faq-lit....html#faq-20.7 and the entry below it