예제 #1
0
        void Test()
        {
            ProtectedBaseClass   b = new ProtectedBaseClass();
            ProtectedDerivated   d = new ProtectedDerivated();
            ProtectedSecondClass s = new ProtectedSecondClass();

            // can't access becasue is protected
            //b.X = 10;
            //s.X = 10;
            //d.X = 10;
        }
예제 #2
0
        void Test()
        {
            ProtectedBaseClass   b = new ProtectedBaseClass();
            ProtectedDerivated   d = new ProtectedDerivated();
            ProtectedSecondClass s = new ProtectedSecondClass();

            // can't access becasue is protected
            //b.X = 10;
            //s.X = 10;

            //while i am inside the class who derivade the base clase can access to protected properties or methods
            d.X = 10;
            X   = 10;
        }