0
Need help with objects.
Plz break down this code so I can understand it. Thx for your help. class myClass { public: void setName(string x) { name = x; } private: string name; }; int main() { myClass myObj; myObj.setName("John"); return 0; }
1 Answer
0
the first part declared a class that get a name and set the name attribute.
in the main part, it defined an object of type myClass and called setName method