0

What notation does the body of Func use to assign the value 3 to n of given class declaration?

Given the class declaration class MyClass { public: ... void Func(); private: int n; }; what notation does the body of Func use to assign the value 3 to n? (a) n = 3; (b) MyClass.n = 3; (c) MyClass::n = 3; (d) someObject.n = 3; OR (d) It can’t be done–n is private.

12th Jun 2019, 6:43 PM
Ayesha Zareen
Ayesha Zareen - avatar
1 Respuesta
+ 4
either n=3; or this->n =3; or Myclass::n=3,
15th Aug 2019, 9:56 PM
ABADA S
ABADA S - avatar