Polymorphism and vectors
Anakreon
anakreonmejdi@yahoo.gr
Mon Jul 11 10:41:00 GMT 2005
I have a little problem with polymorphism and vectors.
Consider the example in the attached file
The output of the program is:
4base, 2b1, 2b2, 2b3
P4base
P4base
P4base
4base
4base
4base
Why are the descendants of class "base" are returned as instances of class "base"?
Is there a solution to this problem?
Thanks is advance,
Anakreon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test3.cpp
Type: text/x-c++src
Size: 800 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20050711/c911409b/attachment.bin>
More information about the Libstdc++
mailing list