#include<iostream>

struct test
    {
        virtual void print() { std::cout << "I'm the parent" << std::endl; }
    };

    struct derived : public test
    {
        virtual void print() { std::cout << "I'm the derived" << std::endl; }
    };

    int main()
    {
        test* a = new test;
        test* b = new derived;

        a->print();
        b->print();

        return 0;
    }