fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base
  5. {
  6. virtual void f() = 0;
  7. };
  8.  
  9. class A: Base
  10. {
  11.  
  12. };
  13.  
  14. int main() {
  15. A a;
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:15:4: error: cannot declare variable 'a' to be of abstract type 'A'
  A a;
    ^
prog.cpp:9:7: note:   because the following virtual functions are pure within 'A':
 class A: Base
       ^
prog.cpp:6:17: note: 	virtual void Base::f()
    virtual void f() = 0;
                 ^
stdout
Standard output is empty