In hope to simplify a homework problem dealing with inheritance, I thought it might be better to use polymorphism to accomplish the task. It isn't required, but makes much more sense if possible. I am, however, getting symbol errors making it work as I thought it should or just the base class definition is called. I want the overloaded function based on the object to be called.
template <class T>
class Fruit {
private:
int count;
T type;
public:
virtual void Info();
};
template <class T>
class Apple : public Fruit<T> {
private:
int variety;
public:
void Info();
};
// more fruit-child classes
vector<Fruit<int> > fruits; // contains object of various derived types
...
for(int i=0; i<fruits.size(); i++
fruits[i].Info();