fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A{
  5. public:
  6. A(){};
  7. ~A(){};
  8. virtual void foo(int a, int b) = 0;
  9. };
  10. class B : public A
  11. {
  12. public:
  13. B(){};
  14. ~B(){};
  15. void foo(int a){};
  16. };
  17.  
  18. int main() {
  19. // your code goes here
  20. B b;
  21. b::A::foo();
  22. return 0;
  23. }
Compilation error #stdin compilation error #stdout 0s 3136KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:20:4: error: cannot declare variable 'b' to be of abstract type 'B'
  B b;
    ^
prog.cpp:10:7: note:   because the following virtual functions are pure within 'B':
 class B : public A
       ^
prog.cpp:8:15: note: 	virtual void A::foo(int, int)
  virtual void foo(int a, int b) = 0;
               ^
prog.cpp:21:2: error: 'b' is not a class, namespace, or enumeration
  b::A::foo();
  ^
stdout
Standard output is empty