0
Still dont understand this code
#include <iostream> #include <string> using namespace std; class myClass { public: void setName(string x) { name = x; } private: string name; }; int main() { myClass myObj; myObj.setName("John"); return 0; }
3 ответов
0
Like I thought if you set a string name to private its not supposed to display output but this this one displays an output of john