.net - protected keyword -


I do not understand the protected access modifier

By reading MSDN, it seems that I have class A Declare Protected Property in Class B has to pass class A and then use the property.

My problem occurs when I can not enter class BI in a safe way. Psuedo code below

  class {{protected} steve {get; Set}} class B: a {} console app private foo = new class B (); Foo.steve = 3;   

I think this code will not be compiled, I see the principle that I can not use Steve from the immediate version of B. Thanks a lot for your help.

protected members can be accessed within the derived classes, but others For, it is such as private this means:
You can add one or b or any other derivative type of member Steve . But you can not access Steve from the outside.

Comments