Hi!
I've written a program in which I have a base class(named "Account") and some sub-classes. the subclasses have some extra attributes which the base class do not. there's a vector in my program, in which I keep the objects of any of the subclasses' types. since there are various subclasses and I wanna keep the built objects in a single vector, I have declared the vector to be of type "Account".
vector<Account> accounts;
when I wanna access the attributes exclusive to any of the subclasses via the objects of the vector "account", it gives this error:
class Account has no member "the specified attribute X".
I know I have declared my vector as an Account-typed one; which lacks attribute X; but the object is actually of type subclass Y and while being constructed, it has a built-in attribute Y. has it somewhat truncated Y, when being pushed_backed into the vector <Account>?
if not, how can I access this attribute mentioned?