Exemplo n.º 1
0
        static void Main(string[] args)
        {
            MyDerivedClass derivedObj = new MyDerivedClass();
            derivedObj.myPublicField = 66;

            MyBaseClass baseObj = new MyBaseClass();
            baseObj.myPublicField = 77;
        }
Exemplo n.º 2
0
        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;


        }