* Method Man:
"David White" <no@email.provided> wrote in message
news:1f******************@nasal.pacific.net.au... "uday" <ka***********@yahoo.co.in> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com... can u explain me the concept of virtual constructor. Does such concept
exists in c++
http://www.parashift.com/c++-faq-lit....html#faq-20.6
I'm having trouble understanding this line from that FAQ:
"This function will work correctly regardless of whether the Shape is a
Circle, Square, or some other kind-of Shape that doesn't even exist yet."
The above means that the code calling the virtual constructor does not
need to know the particular kind of Shape. A compiled version of such
code, X, can be linked to other code so that it will be creating a kind
of Shape that didn't exist when X was compiled. The new kind of Shape
is introduced after compilation, but before linking, of X.
By the way, I should mention that the term "virtual constructor" has
another common meaning, namely that of a constructor that can be fully
or partially overridden in a derived class. I think this is the more
natural meaning. However, the first meaning (20.6) was introduced first
in the FAQ, and so the second needed a new term, "Dynamic Binding During
Initialization", or DBDI, which Marshall invented when we introduced a
discussion of techniques for the second meaning in the FAQ.
You find that discussion at <url:
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.4>.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?