#include #include struct Basis { virtual ~Basis(){} }; struct Abgeleitet : Basis { void hallo() { std::cout << "Hallo\n"; } }; int main() { std::shared_ptr p = std::make_shared(); if (auto q = std::dynamic_pointer_cast(p)) { q->hallo(); } }