Ejemplo n.º 1
0
        public void TestInterviewMethod()
        {
            char   ch = 'g';
            string s  = ch.ToString();
            string s1 = "I am a human being" + ch;

            Console.WriteLine(s1);

            NStruct n1 = new NStruct();
            NClass  n2 = new NClass();

            n1.x = 10;
            n2.x = 10;
            MethodOne(n1);
            MethodTwo(n2);
            Console.WriteLine(n1.x); // 10
            Console.WriteLine(n2.x); // 20
            n1.StructMethod();

            NChild child = new NChild();

            child.x = 100;
            child.y = 50;
            NClass nClass = child;

            Console.WriteLine(nClass.x);
            NChild child1 = (NChild)nClass;

            Console.WriteLine(child1.y); // 50

            Child c = new Child();
            Base  b = c;

            b.MethodB(); // Child : MethodB
            b.MethodC(); // Base : MethodC
            Child c1 = (Child)b;

            c1.MethodB(); // Child : MethodB
            c1.MethodC(); // Child : MethodC
        }
Ejemplo n.º 2
0
 public void MethodTwo(NClass n)
 {
     n.x = 20;
 }