fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. class colors {
  5. public:
  6. int color = '1';
  7. };
  8. class shades: public colors
  9. {
  10. public:
  11. int color = '2';
  12. };
  13.  
  14. int main() {
  15. shades w;
  16. shades b;
  17. cout<< w.color;
  18.  
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:17:1: error: ‘cout’ was not declared in this scope
 cout<< w.color;
 ^~~~
prog.cpp:17:1: note: suggested alternative:
In file included from prog.cpp:1:0:
/usr/include/c++/6/iostream:61:18: note:   ‘std::cout’
   extern ostream cout;  /// Linked to standard output
                  ^~~~
stdout
Standard output is empty