[ create a new paste ] login | about

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

C++, pasted on Dec 9:
struct IHoge {
virtual ~IHoge(void) {}
virtual void func(void) = 0;
};

struct IFuga {
virtual ~IFuga(void) {}
virtual void func(void) = 0;
};

struct Foo : IHoge , IFuga {
void func(void) { std::cout << "helloworld" << std::endl; }
};

int main(void) {
  Foo * p = new Foo;
  IHoge * h = p;
  IFuga * f = p;
  p->func();
  h->func();
  f->func();
  delete p;
  return 0;
}


Output:
1
2
3
helloworld
helloworld
helloworld


Create a new paste based on this one


Comments: