Please bear with me as I am awful with pointers. My instructor gave us an assignment whose main focus is inheritance. We have an 'item' class that has 2 classes derived from it, discountItem and taxableItem, the main difference being that they add a tax and a discount to their respective price variables.
Our teacher gave us a skeleton app that we have to use, which has a (STL) list of item pointers, which are supposed to "be allowed to point to an item, discountItem or taxableItem'. Its declared in main and each of the application's functions carry it as a parameter. The list instantiation is as follows:
list<item*> List;
We are reading in data from a file through a function, and its simple enough to read the data into its respective ADT because the istream is overloaded, so I can simple do file >> regItem, file >> discountItem, etc., but I cannot figure how to insert each of these items into the list because the list is instantiated as pointers. I can't do
alist.insert(i, regItem);
because its a list of pointers apparently! I'm going to go out on a limb and assume it has something to do with iterators, as some of the functions have an iterator itr as a parameter as well.
Any help at all to help me at least get started in getting the data into a transportable format would be awesome!
PS: I already wrote out the derived classes, etc, and we have to do simple things with the menu driven application such as add to the list, remove, view, change, print, etc. (all with the list as a parameter obviously), but I can't go any further until I actually know how to get the data into the list to begin with!