fork download
  1. #include <iostream>
  2. #include <conio.h>
  3. using namespace std;
  4. class A
  5. {
  6. int a,b,c; //По умолчанию private.
  7. };
  8.  
  9. class B:public A //Применили наследование и на основе класса A создали класс B
  10. {
  11. };
  12.  
  13. class C //Независимый класс
  14. {
  15. };
  16.  
  17. A obj_A; //Экземпляр класса A
  18. B obj_B; //Экземпляр класса B
  19. C obj_C; //Экземпляр класса С
  20.  
  21. void main()
  22. {
  23.  
  24. cout<<sizeof(obj_A)<<endl; //Вывели на экран размер объекта от класса A
  25. cout<<sizeof(obj_B)<<endl; //Вывели на экран размер объекта от класса B
  26. cout<<sizeof(obj_C)<<endl; //Вывели на экран размер объекта от класса C
  27.  
  28. getch();
  29. return;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
stdout
Standard output is empty