fork download
  1. #include<iostream>
  2. #include<string>
  3.  
  4. using namespace std;
  5.  
  6. class MyStr {
  7. public:
  8. MyStr();
  9. void mystring(string);
  10. private:
  11. string my_str;
  12. };
  13.  
  14.  
  15. void MyStr::mystring(string my_str){
  16. getline(cin,my_str); //print name
  17. cout<<"Hello,"<<' '<<my_str<<' '<<"!"<<' '<<"How are you?";
  18. }
  19.  
  20.  
  21. int main() {
  22.  
  23. MyStr my_str;
  24. cout<<"And now you will see, what you do!"<<endl<<endl;
  25. my_str.mystring("This is string");
  26. return 0;
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/home/O3AvpY/ccPHE2qV.o: In function `main':
prog.cpp:(.text+0x1e5): undefined reference to `MyStr::MyStr()'
collect2: ld returned 1 exit status
stdout
Standard output is empty