fork download
  1. class A {
  2. virtual void f() = 0;
  3. virtual void g() = 0;
  4. };
  5.  
  6. class B {
  7. void f() {}
  8. };
  9.  
  10. class C : public B, public A {
  11. void g() {}
  12. };
  13.  
  14. int main() {
  15. C c;
  16. }
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 ‘c’ to be of abstract type ‘C’
  C c;
    ^
prog.cpp:10:7: note:   because the following virtual functions are pure within ‘C’:
 class C : public B, public A {
       ^
prog.cpp:2:15: note: 	virtual void A::f()
  virtual void f() = 0;
               ^
stdout
Standard output is empty