I'm new to C++ and learning the ropes (coming from a Java background). I've tried to have a vector of abstract classes but the compiler chokes if i try and call the push_back method.
Heres what I'm doing (in simple terms), I have an abstract Account class (there are many different types of accounts but all have the same properties) which i need to store as a vector (as opposed to an array purely because our collection grows/shrinks) now I'm using several (pure) virtual functions in the Account.hpp file so it is an abstract class. Two implemented classes TaxAccount and SalesAccount are created and everything seems to work, unfortunately I cant add any instances of TaxAccount or Sales account to the vector of pointers.
Declared the abstract class and have this in my header:
Adding it like so in accountHandler.cpp:
void AccountHandler::addAccount(const Account* item)
Error 2 error C2664: 'std::vector<_Ty>::push_back' : cannot convert parameter 1 from 'const Account *' to 'Account *const &' x:UsersEmilyGDSBAAccountHandler.cpp 15