[ create a new paste ] login | about

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

C++, pasted on Sep 7:
class A
{
    public:
         virtual void f(){ printf("A.f "); }
         ~A(){ f(); }
};

class B : public A
{
    A a;

    public:
         void f(){ printf("B.f "); }
         B(){ throw -1; }
        ~B(){ f(); }
};

int main()
{
    try{ B b; }
    catch(...){ printf("Exc");}
}


Output:
1
A.f A.f Exc


Create a new paste based on this one


Comments: