Here is the background:
I am working on a project in which I have a base class called Account. In this base class I have the functions updateValue(int num_of_years) and void toString(); Next I have three subclasses of this base class, which are MutualFund, Bond, Buried. Each of these is a different type of account. In each of these class I have redefined the functions updateValue(int num_of_years) and toString().
Alright, now in my main function I am creating a vector of pointers to the base class, vector<Account*> my_basket. Then I am adding five or six accounts of each kind. So now I have a vector of pointers to the account class and each pointer is pointing to either a mutual fund, bond, or buried.
Here is the problem:
One of the options in the program is for the user to enter the account number, enter a new number of years and for the value to be updated. however, when I try to update the value it always calls the definition of the function updateValue(int num_of_years) that is found in the base class, instead of saying okay this account is a mutualfund and using the updateValue function found there. I need help as to how to make it use the appropriate updateValue function depending on the type of account it is.