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
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.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
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
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared