If we have a User
base class with properties username
and password
.
And a child class SpecialUser
, with an extra property special
.
I know I can declare ArrayList<User> users = new ArrayList<User>();
and then add SpecialUser
object to users
, but I can only access the properties inherited from base class (username
and password
) that way.
Is there a way to add a SpecialUser
to the ArrayList and be able to access special
property? Or should they be stored seperately?
Kind regards