fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. class Student {
  5. public:
  6. Student(const char* name) : imya(name) {};
  7. const char* get_imya() {
  8. return imya.c_str();
  9. }
  10.  
  11. private:
  12. std::string imya;
  13. };
  14.  
  15. int main() {
  16. Student s("Vasya Pupkin");
  17.  
  18. std::cout << s.get_imya() << std::endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Vasya Pupkin