Look up “Polymorphism”.
When subThing
is derived from Thing
, an instance of subThing
is also an instance of Thing
, so a subThing*
pointer can be used anywhere a Thing*
pointer can be used. Same thing with subThing&
and Thing&
references. Just watch out for “Object Slicing”. Polymorphic access to an object only works when accessing the object via a pointer or reference.