+ 2
C++ class
hi, what is wrong with my code? why it does not have any output? #include <iostream> #include <string> using namespace std; class myClass { public: void setName(string x) { x = name; } string getName() { return name; } private: string name; }; int main () { myClass myObj; myObj.setName("dar"); cout << myObj.getName(); return 0; }
2 ответов
+ 3
thank you