Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Press 1 to view Using Private method(Line 87 to 99)");
            Console.WriteLine("Press 2 to run Using Protected and Private method(Line 38 to 66)");
            Console.WriteLine("Press 3 to run Using Internal method(Line 74 to 82)");
            Console.WriteLine("Press 4 to run Using Properties method(Line 108 to 121)");
            Console.WriteLine("Go check out my Using Inheritance and Interfaces method(Line 125 to 146) in code");

            switch (Console.ReadLine())
            {
            case "1": {
                Accessibility a = new Accessibility();
                a.MyProperty = "Private value changed";
                Console.WriteLine(a.MyProperty);
                break;
            }

            case "2": {
                Derived d = new Derived();
                d.MyDerivedMethod();
                break;
            }

            case "3": {
                MyInternalClass i = new MyInternalClass();
                i.MyMethod();
                break;
            }

            case "4": {
                Person p = new Person();
                p.FirstName = "John";
                Console.WriteLine("Propery value changed to {0}!", p.FirstName);
                break;
            }

            default: {
                Console.WriteLine("Entered value does not associate with any of the provided options!");
                break;
            }
            }
        }
Beispiel #2
0
        public void TestMethod1()
        {
            MyInternalClass myclass = new MyInternalClass();

            myclass.MyMethod();
        }
Beispiel #3
0
        public static void Start()
        {
            var internalClass = new MyInternalClass();

            internalClass.MyMethod();
        }