Пример #1
0
    public int Test_Nested(ClsA Nested_Cls)
    {
        int mi_RetCode = 100;

        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////
        // ACCESS NESTED FIELDS/MEMBERS
        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////

        /////////////////////////////////
        // Test instance field access
        Nested_Cls.NestFldAPubInst = 100;
        if (Nested_Cls.NestFldAPubInst != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static field access
        A.ClsA.NestFldAPubStat = 100;
        if (A.ClsA.NestFldAPubStat != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test instance MethAod access
        if (Nested_Cls.NestMethAPubInst() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static MethAod access
        if (A.ClsA.NestMethAPubStat() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test virtual MethAod access
        if (Nested_Cls.NestMethAPubVirt() != 100)
        {
            mi_RetCode = 0;
        }

//@csharp - @todo - @bugbug - This is coded poorly in L-1-7-3 and L-1-8-3, we should be able to access assembly and famorassem members, but because of they way it's coded that's illegal according to C#, fix this up

        ////////////////////////////////////////////
        // Test access from within the nested class
        if (Nested_Cls.Test() != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClsA a = new ClsA();

            ClsB b = new ClsB();

            string c;

            a.x = 10;

            b.x = 20;

            c = "a= " + a.x + " b= " + b.x;

            MessageBox.Show(c);
        }
Пример #3
0
 public object objQ(string str)
 {
     if (str.ToUpper() == "A")
     {
         ClsA objA = new ClsA();
         return(objA);
     }
     else if (str.ToUpper() == "B")
     {
         ClsB objB = new ClsB();
         return(objB);
     }
     else
     {
         return("");
     }
 }
Пример #4
0
        public static bool UnitTest_1009()
        {
            B test = new B();

            test.TestVirtual();
            Console.WriteLine(string.Format("A={0},B={1}", test.A, test.B));
            ClsA test2 = (ClsA)test;

            test2.TestVirtual();
            Console.WriteLine(string.Format("A={0},B={1}", test2.A, test2.B));
            test2 = new C();
            test2.TestVirtual();
            Console.WriteLine(string.Format("A={0},B={1}", test2.A, test2.B));
            ClsA test3 = new ClsA();

            test3.TestVirtual();
            Console.WriteLine(string.Format("A={0},B={1}", test3.A, test3.B));
            test = test3 as B;
            if (test == null)
            {
                Console.WriteLine(string.Format("A={0},B={1}", test.A, test.B));
            }
            return(test3.B);
        }
Пример #5
0
    public int Test_Nested(ClsA Nested_Cls)
    {
        int mi_RetCode = 100;

        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////
        // ACCESS NESTED FIELDS/MEMBERS
        /////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////

        /////////////////////////////////
        // Test instance field access
        Nested_Cls.NestFldAPubInst = 100;
        if (Nested_Cls.NestFldAPubInst != 100)
        {
            mi_RetCode = 0;
        }

        Nested_Cls.NestFldAAsmInst = 100;
        if (Nested_Cls.NestFldAAsmInst != 100)
        {
            mi_RetCode = 0;
        }

        Nested_Cls.NestFldAFoaInst = 100;
        if (Nested_Cls.NestFldAFoaInst != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static field access
        A.ClsA.NestFldAPubStat = 100;
        if (A.ClsA.NestFldAPubStat != 100)
        {
            mi_RetCode = 0;
        }

        A.ClsA.NestFldAAsmStat = 100;
        if (A.ClsA.NestFldAAsmStat != 100)
        {
            mi_RetCode = 0;
        }

        A.ClsA.NestFldAFoaStat = 100;
        if (A.ClsA.NestFldAFoaStat != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test instance MethAod access
        if (Nested_Cls.NestMethAPubInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethAAsmInst() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethAFoaInst() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test static MethAod access
        if (A.ClsA.NestMethAPubStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (A.ClsA.NestMethAAsmStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (A.ClsA.NestMethAFoaStat() != 100)
        {
            mi_RetCode = 0;
        }

        /////////////////////////////////
        // Test virtual MethAod access
        if (Nested_Cls.NestMethAPubVirt() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethAAsmVirt() != 100)
        {
            mi_RetCode = 0;
        }

        if (Nested_Cls.NestMethAFoaVirt() != 100)
        {
            mi_RetCode = 0;
        }

        ////////////////////////////////////////////
        // Test access from within the nested class
        if (Nested_Cls.Test() != 100)
        {
            mi_RetCode = 0;
        }

        return(mi_RetCode);
    }
Пример #6
0
	public int Test_Nested(ClsA Nested_Cls){
		int mi_RetCode = 100;
		
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		// ACCESS NESTED FIELDS/MEMBERS
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////
		// Test instance field access
		Nested_Cls.NestFldAPubInst = 100;
		if(Nested_Cls.NestFldAPubInst != 100)
			mi_RetCode = 0;
		
		Nested_Cls.NestFldAAsmInst = 100;
		if(Nested_Cls.NestFldAAsmInst != 100)
			mi_RetCode = 0;
		
		Nested_Cls.NestFldAFoaInst = 100;
		if(Nested_Cls.NestFldAFoaInst != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static field access
		A.ClsA.NestFldAPubStat = 100;
		if(A.ClsA.NestFldAPubStat != 100)
			mi_RetCode = 0;
		
		A.ClsA.NestFldAAsmStat = 100;
		if(A.ClsA.NestFldAAsmStat != 100)
			mi_RetCode = 0;
		
		A.ClsA.NestFldAFoaStat = 100;
		if(A.ClsA.NestFldAFoaStat != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test instance MethAod access  
		if(Nested_Cls.NestMethAPubInst() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethAAsmInst() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethAFoaInst() != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static MethAod access
		if(A.ClsA.NestMethAPubStat() != 100)
			mi_RetCode = 0;
		
		if(A.ClsA.NestMethAAsmStat() != 100)
			mi_RetCode = 0;
		
		if(A.ClsA.NestMethAFoaStat() != 100)
			mi_RetCode = 0;  
		
		/////////////////////////////////
		// Test virtual MethAod access
		if(Nested_Cls.NestMethAPubVirt() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethAAsmVirt() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethAFoaVirt() != 100)
			mi_RetCode = 0;  
		
		////////////////////////////////////////////
		// Test access from within the nested class
		if(Nested_Cls.Test() != 100)
			mi_RetCode = 0;

		return mi_RetCode;
	}
Пример #7
0
	public int Test_Nested(ClsA Nested_Cls){
		int mi_RetCode = 100;
		
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		// ACCESS NESTED FIELDS/MEMBERS
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////
		// Test instance field access
		Nested_Cls.NestFldAPubInst = 100;
		if(Nested_Cls.NestFldAPubInst != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static field access
		A.ClsA.NestFldAPubStat = 100;
		if(A.ClsA.NestFldAPubStat != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test instance MethAod access  
		if(Nested_Cls.NestMethAPubInst() != 100)
			mi_RetCode = 0;
				
		/////////////////////////////////
		// Test static MethAod access
		if(A.ClsA.NestMethAPubStat() != 100)
			mi_RetCode = 0;
				
		/////////////////////////////////
		// Test virtual MethAod access
		if(Nested_Cls.NestMethAPubVirt() != 100)
			mi_RetCode = 0;

//@csharp - @todo - @bugbug - This is coded poorly in L-1-7-3 and L-1-8-3, we should be able to access assembly and famorassem members, but because of they way it's coded that's illegal according to C#, fix this up
		
		////////////////////////////////////////////
		// Test access from within the nested class
		if(Nested_Cls.Test() != 100)
			mi_RetCode = 0;

		return mi_RetCode;
	}