fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Oblast
  5. {
  6. public :
  7. char name [64];
  8. void show_Oblast(void)
  9. {
  10. cout << "Название: " << name << endl;
  11.  
  12. };
  13.  
  14. class Megapolis : public Oblast
  15. {
  16.  
  17. };
  18.  
  19. class Gorod : public Megapolis
  20. {
  21.  
  22. };
  23. class Mesto : public Gorod
  24. {
  25.  
  26. };
  27. int main()
  28. {
  29. Mesto A;
  30. strcpy(A.name, "Tolyatti");
  31. A.show_Oblast();
  32.  
  33. return 0;
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:14: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:34:1: error: expected ‘}’ at end of input
 }
 ^
prog.cpp: In member function ‘int Oblast::main()’:
prog.cpp:30:11: error: ‘class Oblast::Mesto’ has no member named ‘name’
  strcpy(A.name, "Tolyatti");
           ^
prog.cpp:30:27: error: ‘strcpy’ was not declared in this scope
  strcpy(A.name, "Tolyatti");
                           ^
prog.cpp:31:4: error: ‘class Oblast::Mesto’ has no member named ‘show_Oblast’
  A.show_Oblast();
    ^
prog.cpp: At global scope:
prog.cpp:34:1: error: expected unqualified-id at end of input
 }
 ^
stdout
Standard output is empty