fork(7) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class ITestA
  5. {
  6. public:
  7. virtual void methodA() = 0;
  8. };
  9.  
  10. class ITestB : public ITestA
  11. {
  12. public:
  13. virtual void methodB() = 0;
  14. };
  15.  
  16. class CBaseA : public ITestA
  17. {
  18.  
  19. virtual void methodA() override
  20. {
  21.  
  22. }
  23. };
  24.  
  25. class CBaseB : public CBaseA, public ITestB
  26. {
  27.  
  28. virtual void methodB() override
  29. {
  30.  
  31. }
  32. };
  33.  
  34. int main() {
  35. CBaseB b;
  36. return 0;
  37. }
  38.  
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:35:9: error: cannot declare variable ‘b’ to be of abstract type ‘CBaseB’
  CBaseB b;
         ^
prog.cpp:25:7: note:   because the following virtual functions are pure within ‘CBaseB’:
 class CBaseB : public CBaseA, public ITestB
       ^~~~~~
prog.cpp:7:18: note: 	virtual void ITestA::methodA()
     virtual void methodA() = 0;
                  ^~~~~~~
stdout
Standard output is empty