static void Main(string[] args) { MyDerivedClass derivedObj = new MyDerivedClass(); derivedObj.myPublicField = 66; MyBaseClass baseObj = new MyBaseClass(); baseObj.myPublicField = 77; }
public void MyMethod() { this.myProtectedField = 11; this.myPublicField = 22; MyDerivedClass derivedObj = new MyDerivedClass(); derivedObj.myPublicField = 44; derivedObj.myProtectedField = 33; //only accesable in the derived class MyBaseClass baseObj = new MyBaseClass(); baseObj.myPublicField = 55; }