int main,
The releationship between the classes is totaly different. The OPs code has an
is-a[1] relationship between the classes.
If you are modelling a car park (car lot?) you have some classes this like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
class Car
{
…
}
class SportCar: Car
{
…
}
class Suv: Car
{
…
}
| |
Then for your parking spaces you would have an array that would hold one car in each ‘slot’. Something like
Car* spaces[100];
. So now each slot can have a car, it may be a Suv as that is-a Car, or it may be a SportCar as that is-a Car.
In your code you have an
has-a[2] relationship between classes.
If you map the classes above back to your code, you would have a Car the is made up of an Suv and a SprotCar, which would not make sense. The OP want an Object that is either a plane or a sphere not both a plane and a sphere.
HTH
[1] http://en.wikipedia.org/wiki/Is-a
[2] http://en.wikipedia.org/wiki/Has-a