fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Oblast
  5. {
  6. public :
  7. char name [64];
  8. {
  9. cout << "Имя: " << name << endl;
  10.  
  11. };
  12.  
  13. class Megapolis : public Oblast
  14. {
  15.  
  16. };
  17.  
  18. class Gorod : public Megapolis
  19. {
  20.  
  21. };
  22. class Mesto : public Gorod
  23. {
  24.  
  25. };
  26. int main()
  27. {
  28. Mesto A;
  29. strcpy(A.name, "qwe");
  30.  
  31. return 0;
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:2: error: expected unqualified-id before ‘{’ token
  {
  ^
prog.cpp:13:26: error: invalid use of incomplete type ‘class Oblast’
 class Megapolis : public Oblast
                          ^
prog.cpp:4:7: error: forward declaration of ‘class Oblast’
 class Oblast
       ^
prog.cpp:32:1: error: expected ‘}’ at end of input
 }
 ^
prog.cpp: In member function ‘int Oblast::main()’:
prog.cpp:29:11: error: ‘class Oblast::Mesto’ has no member named ‘name’
  strcpy(A.name, "qwe");
           ^
prog.cpp:29:22: error: ‘strcpy’ was not declared in this scope
  strcpy(A.name, "qwe");
                      ^
prog.cpp: At global scope:
prog.cpp:32:1: error: expected unqualified-id at end of input
 }
 ^
stdout
Standard output is empty