fork(2) download
  1. #include <cstdio>
  2.  
  3. class A
  4. {
  5. public:
  6. virtual void vf();
  7. };
  8.  
  9. class B : public A
  10. {
  11. public:
  12. void vf()
  13. {
  14. printf("B::vf\n");
  15. }
  16. };
  17.  
  18. int main()
  19. {
  20. A a;
  21. B b;
  22. b.vf();
  23.  
  24. A* pa= &a;
  25. A* pb= &b;
  26. pa->vf();
  27. pb->vf();
  28. return 0;
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/qUgZY1/ccVE8Zz0.o: In function `main':
prog.cpp:(.text.startup+0x14): undefined reference to `vtable for A'
prog.cpp:(.text.startup+0x2d): undefined reference to `A::vf()'
/home/qUgZY1/ccVE8Zz0.o:(.rodata._ZTI1B[_ZTI1B]+0x8): undefined reference to `typeinfo for A'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty