fork(7) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base
  5. {
  6. public:
  7. virtual void Foo() = 0;
  8. };
  9.  
  10. // ***** This is how you define pure virtual function outside class
  11. void Base::Foo () {
  12. cout << "Base::Foo()\n";
  13. }
  14.  
  15. class Derived
  16. : public Base
  17. {
  18. public:
  19. void Foo() {
  20. Base::Foo(); // ***** This is how you call it
  21. }
  22. };
  23.  
  24. int main() {
  25. Derived d;
  26. d.Foo();
  27. return 0;
  28. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Base::Foo()