[ create a new paste ] login | about

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

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

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

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

};

int main(int argc, char **argv) {
  
 B b;
 IB &ib = b;
 ib.f();
 std::cout << "sizeof(B): " <<sizeof(b) << std::endl;
}


Output:
1
2
f() called
sizeof(B): 8


Create a new paste based on this one


Comments: