On 4/26/23 18:20, U.Mutlu wrote:
How best to do this?
In a word or two, don't. This is basic OOP: all accesses to an object should be via its (possibly virtual) member functions. There's nothing to stop you from defining virtual Dog_t Base_t::as_dog() { return nullptr; } in the base class, and overriding it as virtual Dog_t Dog_t::as_dog() { return this; } in the derived class. If you really need to... Can I remind you that this list is for specific GCC help, not C++ language issues? Thanks. -- Andrew Haley (he/him) Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671