fork download
  1. #include <iostream>
  2. #include <string>
  3. class Rem
  4. {
  5. public:
  6. enum Nums
  7. {
  8. NUM_ONE,
  9. NUM_TWO,
  10. };
  11. private:
  12. std::string m_name;
  13. int m_val;
  14. public:
  15. Rem(Rem::Nums var,std::string name,int val)
  16. : Nums(var),string m_name(name),m_val(val)
  17. {}
  18. std::string get(Rem::Nums var)
  19. {
  20. switch(var)
  21. {
  22. case NUM_ONE: return NUM_ONE;
  23. case NUM_TWO: return NUM,_TWO;
  24. }
  25. }
  26. void print()
  27. {
  28. std::cout<<var<<" " <<m=name<<m_val;
  29. }
  30. };
  31. int main()
  32. {
  33. return 0;
  34. }
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In constructor ‘Rem::Rem(Rem::Nums, std::__cxx11::string, int)’:
prog.cpp:16:7: error: ‘enum Rem::Nums’ is not a non-static data member of ‘Rem’
     : Nums(var),string m_name(name),m_val(val)
       ^~~~
prog.cpp:16:17: error: class ‘Rem’ does not have any field named ‘string’
     : Nums(var),string m_name(name),m_val(val)
                 ^~~~~~
prog.cpp:16:24: error: expected ‘(’ before ‘m_name’
     : Nums(var),string m_name(name),m_val(val)
                        ^~~~~~
prog.cpp:16:24: error: expected ‘{’ before ‘m_name’
prog.cpp: In member function ‘std::__cxx11::string Rem::get(Rem::Nums)’:
prog.cpp:22:22: error: could not convert ‘NUM_ONE’ from ‘Rem::Nums’ to ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’
 case NUM_ONE: return NUM_ONE;
                      ^~~~~~~
prog.cpp:23:22: error: ‘NUM’ was not declared in this scope
 case NUM_TWO: return NUM,_TWO;
                      ^~~
prog.cpp:23:26: error: ‘_TWO’ was not declared in this scope
 case NUM_TWO: return NUM,_TWO;
                          ^~~~
prog.cpp: In member function ‘void Rem::print()’:
prog.cpp:28:12: error: ‘var’ was not declared in this scope
 std::cout<<var<<" " <<m=name<<m_val;
            ^~~
prog.cpp:28:23: error: ‘m’ was not declared in this scope
 std::cout<<var<<" " <<m=name<<m_val;
                       ^
prog.cpp:28:25: error: ‘name’ was not declared in this scope
 std::cout<<var<<" " <<m=name<<m_val;
                         ^~~~
stdout
Standard output is empty