Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Same Assembly Base Class");
            Console.WriteLine("////////////////////////////////////////");
            SameAssemblyBaseClass sameAssemblyBaseClass = new SameAssemblyBaseClass();

            sameAssemblyBaseClass.test();

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Same Assembly Derived Class");
            Console.WriteLine("////////////////////////////////////////");
            SameAssemblyDerivedClass sameAssemblyDerivedClass = new SameAssemblyDerivedClass();

            sameAssemblyDerivedClass.test();



            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Same Assembly Different Class");
            Console.WriteLine("////////////////////////////////////////");
            SameAssemblyDifferentClass sameAssemblyDifferentClass = new SameAssemblyDifferentClass();

            sameAssemblyDifferentClass.ToString();

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void test()
        {
            SameAssemblyDerivedClass p = new SameAssemblyDerivedClass();

            // NOT OK -- Console.WriteLine(privateVariable);
            Console.WriteLine("ERROR: 'SameAssemblyBaseClass.privateVariable' is inaccessible due to its protection level");
            // OK
            Console.WriteLine(p.publicVariable);
            // OK
            Console.WriteLine(p.protectedVariable);
            // OK
            Console.WriteLine(p.internalVariable);
            // OK
            Console.WriteLine(p.protectedInternalVariable);
        }