i created an application depicting the protected access modifiers, using the sample provided on MSDN site, but it seems to be error prone, below is the code i am using:

and below is the sample from MSDN site:

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your
AccessModifiersCSharpclass which is whereMainis defined does not inherit fromClass1, so has no access to itsprotectedmembers.You can access
Method1from yourClass2as it does inherit fromClass1.The difference between your code and the MSDN code is that class
Bthat containsMaininherits directly fromA.