Is protected member accessible within the class where it's been declared and within its derived class's INSTANCES? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is protected member accessible within the class where it's been declared and within its derived class's INSTANCES?

Well, I just chanced upon this question while participating in a C# challenge. Suggested answers are "True" and "False". There is no way you can access a protected member from an instance of a class unless you are using reflection which is kind of a cheating lol. But when you select "False", a message "Wrong" arises. So, there is a mistake in the formulation of this question and the author probably wanted to ask if protected member, declared in a base class, is accessible withing the derived class.

3rd Feb 2017, 11:07 AM
Vladimir Poddukin
Vladimir Poddukin - avatar
1 Answer
0
I think it would be great if there was a separate section where such mistakes could be discussed in SoloLearn
3rd Feb 2017, 11:09 AM
Vladimir Poddukin
Vladimir Poddukin - avatar