fork download
  1. #include <iostream>
  2. class Base {
  3. public:
  4. virtual int foo() const = 0;
  5. int bar() const;
  6. };
  7.  
  8. class Child : public Base {
  9. public:
  10. int foo() const;
  11. };
  12.  
  13.  
  14. int Child::foo() const {
  15. return 5;
  16. }
  17.  
  18. int Base::bar() const {
  19. return this->foo() * 3;
  20. }
  21.  
  22. int main()
  23. {
  24. Child c;
  25. std::cout << c.bar();
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 4480KB
stdin
Standard input is empty
stdout
15