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:34:1: error: expected ‘}’ at end of input
 }
 ^
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: At global scope:
prog.cpp:34:1: error: expected unqualified-id at end of input
 }
 ^
stdout
Standard output is empty