Nuacht
You are looking for polymorphic functionality and the only way to achieve that type of dynamic polymorphism in C++ is via virtual functions. The problem is that this only works on one class.
Tá torthaí a d'fhéadfadh a bheith dorochtana agat á dtaispeáint faoi láthair.
Folaigh torthaí dorochtana