Why does it show error after removing the- private: string name- part of the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does it show error after removing the- private: string name- part of the code?

https://code.sololearn.com/c0HN4ReFyIl9/?ref=app

13th May 2020, 7:58 AM
Cupcakes
3 Answers
0
because if you removed -private: string name-, you'll use a variable *name* that not declared in the class in the setter
13th May 2020, 8:12 PM
Ahmed Mostafa
Ahmed Mostafa - avatar
0
So where can I declare the *name* variable I tried changing the code many times but couldn't
14th May 2020, 6:25 AM
Cupcakes
0
why do you want to remove it it is declared as you do in your code
14th May 2020, 6:29 AM
Ahmed Mostafa
Ahmed Mostafa - avatar