what if i declare a parameter inside constructor which has private access specifier, would parameter also be private? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what if i declare a parameter inside constructor which has private access specifier, would parameter also be private?

class myclass { private: myclass(int m){} };

13th Aug 2018, 2:21 PM
Arush Joshi
Arush Joshi - avatar
1 Answer
+ 4
parameters are not affected by access specifiers, since you cant directly use a parameter outside of the method you are calling. all parameters are retained within the scope of the method
13th Aug 2018, 2:35 PM
Robert Atkins
Robert Atkins - avatar