I have an abstract class called Number and a simple derived class called Double, which has a private variable value and a function called getValue() which returns the value;
I also have a vector of pointers of type Number which are pointing to Double.
... vector<Number*> v1; v1.push_back(new Double(2.3)); v1.push_back(new Double(1.4)); ...
I'm trying to print the values with a foor loop, with a vector<Number*>::iterator, using begin() and end() member function but i can't get it to work.
I tried it like this but it's obviously wrong:
vector<Number*>::iterator j; for(int j=v1.begin(); j<v1.end(); j++) cout<<v1.at(*j)->getValue();
What should i change?