[ create a new paste ] login | about

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

C++, pasted on May 9:
#include <iostream>

class IA {
public:
   virtual void f()=0; 
};
class IB : public IA {
public:

};
class A : public IA {
public:
  void f() {
    std::cout << "f() called" << std::endl;
  }; 
};
 class B : public A, public IB {
public:
  void f() {A::f();}
};

int main(int argc, char **argv) {

 try {
   B b;
   throw b;
 } catch (IA &ia) {
   ia.f();
 }
}


Output:
1
2
uncaught exception of type B
Aborted.


Create a new paste based on this one


Comments: