[ create a new paste ] login | about

Link: http://codepad.org/PWm5j1im    [ raw code | output | fork ]

C++, pasted on Mar 31:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Base
{
public:
    void init() { onCreate(); }
    virtual void onCreate() { std::cout<<"sadface\n";}
};

class Derived : public Base
{
public:
    void onCreate(){std::cout<<"Hello, World!\n";}
};

int main()
{
    Derived * d = new Derived();
    d->init();
}


Output:
1
Hello, World!


Create a new paste based on this one


Comments: