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; }

28th Apr 2018, 7:44 PM
Gurvir Singh
Gurvir Singh - avatar
1 Resposta
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
28th Apr 2018, 8:15 PM
sajede mirzaei
sajede mirzaei - avatar