fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. class P2 {
  4. protected:
  5. int x, y;
  6. public:
  7. P2(int _x=0, int _y=0): x(_x), y(_y) {};
  8. void Show() {
  9. cout << x * this->y << endl;
  10. }
  11. };
  12. class P2 : public P2 {
  13. }
  14.  
  15. int main() {
  16. // your code goes here
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:12:7: error: redefinition of ‘class P2’
 class P2 : public P2 {
       ^~
prog.cpp:3:7: error: previous definition of ‘class P2’
 class P2 {
       ^~
prog.cpp:12:1: error: new types may not be defined in a return type
 class P2 : public P2 {
 ^~~~~
prog.cpp:12:1: note: (perhaps a semicolon is missing after the definition of ‘<type error>’)
prog.cpp:15:10: error: two or more data types in declaration of ‘main’
 int main() {
          ^
stdout
Standard output is empty