Code:
class Vehicle
{
};
class Car : public Vehicle
{
int MPG;
int NoOfDoors;
}
class Motorbike : public : Vehicle
{
int MPG;
};
In the code above , the base class is Vehicle.
The two inherited classes have different data members.
I want to use a Template (in the hope of storing the different objects within a single linked list).
Such as:
Code:
template<class VEHICLE>
class Vehicle
{
};
template<class VEHICLE>
class Car : public Vehicle
{
int MPG;
int NoOfDoors;
}
template<class VEHICLE>
class Motorbike : public : Vehicle
{
int MPG;
};
I'm not saying I yet have a problem, I am wondering if having different data members in different classes stops you using a Template for all of the classes.