|
-
May 1st, 2005, 05:48 PM
#1
Help with Vectors of Classes and Dervived Classes
Parent Class is Component
Child Classes are Pump, Water, System, Column, Environment
Since all my objects are Components, can I make an vector of Components and use it for any type of Object which I have?
i.e.
vector<CComponent> ComponentList
CPump NewPump
ComponentList.push_back(NewPump)
Is this something doable?
Also
If I wanted to dynamically allocate Components while the program is running, do I have to allocate the Component dynamically, or is that handled within the vector when I push_back?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|