fork download
  1. #include<iostream.h>
  2. class base
  3. {
  4. public:out(){ cout<<"base"; }
  5. };
  6. class deri: public base
  7. {
  8. public: out(){ cout<<"deri";}
  9. };
  10. void main()
  11. {
  12. deri dp[3];
  13. base *b=(base *)dp;
  14. for(int i=0;i<3;i++)
  15. (b++)->out();
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:21: error: iostream.h: No such file or directory
prog.cpp:4: error: ISO C++ forbids declaration of ‘out’ with no type
prog.cpp: In member function ‘int base::out()’:
prog.cpp:4: error: ‘cout’ was not declared in this scope
prog.cpp:4: warning: no return statement in function returning non-void
prog.cpp: At global scope:
prog.cpp:8: error: ISO C++ forbids declaration of ‘out’ with no type
prog.cpp: In member function ‘int deri::out()’:
prog.cpp:8: error: ‘cout’ was not declared in this scope
prog.cpp:8: warning: no return statement in function returning non-void
prog.cpp: At global scope:
prog.cpp:10: error: ‘::main’ must return ‘int’
stdout
Standard output is empty