U
uday
can u explain me the concept of virtual constructor. Does such concept
exists in c++
exists in c++
uday said:can u explain me the concept of virtual constructor. Does such concept
exists in c++
uday said:can u explain me the concept of virtual constructor. Does such concept
exists in c++
David White said:
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."
Method said: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."
What do they mean by "some other kind-of Shape that doesn't even exist
yet."? Are they talking about a forward declared class?
And what does
clone() and create() return if the subtype doesn't exist?
Alf P. Steinbach said:* Method Man: 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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.