I’m very confuse on why classes compose of public and protected methods/variables.
Why only extended classes can access protected methods/variables? Can someone else can help me enlighten the difference between public and protected and it’s functionality.
I’m very confuse on why classes compose of public and protected methods/variables. Why only
Share
Because that’s the definition of “protected”. The accessibility domain of a protected member is the class and its derived classes.
Perhaps you intended to ask:
It’s complicated. For a detailed explanation, see my six part series “Why can I not access a protected member from a derived class?”
http://blogs.msdn.com/b/ericlippert/archive/tags/protected/