fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string m_name = "ok";
  6.  
  7. template<class HAHAHA>
  8. class Trololo
  9. {
  10. public:
  11. Trololo( void ) :
  12. m_name( "oh lol" )
  13. {
  14. }
  15. string m_name;
  16. };
  17.  
  18. template<class DISREGARD_THAT>
  19. class CMyAwesomeClass : public Trololo<DISREGARD_THAT>
  20. {
  21. public:
  22. void SetValue( string value )
  23. {
  24. m_name = value; // Или this->m_name = value;
  25. }
  26. };
  27.  
  28. int main()
  29. {
  30. CMyAwesomeClass<int> c;
  31. c.SetValue( "ok" );
  32. cout << c.m_name << endl;
  33. return 0;
  34. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
oh lol