[SOLVED] Inheritance / Vector Problem
Posted: Wed Jul 29, 2009 11:36 pm
Hello, I have a small problem.
I made a Container class.
A Container class has a vector for other Containers.
A Container class also has a draw function. It draws itself, then all of the members of its vector.
(Containers are drawn as rectangles so I can experiment.)
I can successfully add Containers to Containers and have them drawn.
Then I made a Child Container.
A Child Container is exactly the same, it just calls the parent constructors.
I added a Child Container to a Container's vector, but it will not draw it.
(It will draw everything else though.)
So I think my problem lies in my understanding of inheritance... or possibly vectors.
Any advice?
I made a Container class.
A Container class has a vector for other Containers.
A Container class also has a draw function. It draws itself, then all of the members of its vector.
(Containers are drawn as rectangles so I can experiment.)
I can successfully add Containers to Containers and have them drawn.
Then I made a Child Container.
A Child Container is exactly the same, it just calls the parent constructors.
I added a Child Container to a Container's vector, but it will not draw it.
(It will draw everything else though.)
So I think my problem lies in my understanding of inheritance... or possibly vectors.
Any advice?