Say I have a class named Base
and a class that derives from it called SuperBase
. Given that add
takes in a Base*
, would either of these be valid:
SuperBase *super = new SuperBase;
bases.add(super);
Or
SuperBase *super = new SuperBase;
bases.add((Base*)super);