0
What does the keyword protected do?
I have been learning about private protected and public and I don't fully understand what protected means
1 Answer
+ 2
Private you can access only from this class itself.
If you inherited from this class, you still can't see it from inherited class.
Protected used when you need something available for inherited classes also.
Example:
class A {private static int a; protected static int b;}
class B:A{ public static void main(string str)
{a=1; //should show error
b=1; //should be ok
}