fork download
  1. #include <string>
  2. using namespace std;
  3. static class Trans
  4. {
  5. public:
  6. static wstring AddDoubleQuotes(wstring value) { return L"\"" + value + L"\""; }
  7. static wstring AddDoubleQuotes(double value) { return to_wstring(value); }
  8.  
  9. template <class T>
  10. static wstring Trans::GetSubwstring(wstring key, T value)
  11. {
  12. if (key != L"")
  13. return AddDoubleQuotes(key) + L":" + AddDoubleQuotes(value);
  14. else return AddDoubleQuotes(value);
  15. };
  16.  
  17. Trans() { GetSubwstring(L"", 0); }
  18. };
  19.  
  20. int main(void)
  21. {
  22. Trans::GetSubwstring(L"",0);
  23. getchar();
  24. return 0;
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
compilation info
prog.cpp:10:17: error: extra qualification ‘Trans::’ on member ‘GetSubwstring’ [-fpermissive]
  static wstring Trans::GetSubwstring(wstring key, T value)
                 ^~~~~
prog.cpp:3:1: error: a storage class can only be specified for objects and functions
 static class Trans
 ^~~~~~
stdout
Standard output is empty