예제 #1
0
파일: L-1-4-1.cs 프로젝트: CheneyWu/coreclr
		public int Test_Nested(Cls2 Nested_Cls2){
			int mi_RetCode = 100;
			
			/////////////////////////////////////////////////////////////////////////
			/////////////////////////////////////////////////////////////////////////
			// ACCESS NESTED FIELDS/MEMBERS
			/////////////////////////////////////////////////////////////////////////
			/////////////////////////////////////////////////////////////////////////
			
			/////////////////////////////////
			// Test instance field access
			Nested_Cls2.Nest2FldPubInst = 100;
			if(Nested_Cls2.Nest2FldPubInst != 100)
				mi_RetCode = 0;
			
			//@csharp - Note, CSharp won't allow access of family or private members of a nested class...
			//from it's enclosing class.
			
			Nested_Cls2.Nest2FldAsmInst = 100;
			if(Nested_Cls2.Nest2FldAsmInst != 100)
				mi_RetCode = 0;
			
			Nested_Cls2.Nest2FldFoaInst = 100;
			if(Nested_Cls2.Nest2FldFoaInst != 100)
				mi_RetCode = 0;
			
			/////////////////////////////////
			// Test static field access
			Cls2.Nest2FldPubStat = 100;
			if(Cls2.Nest2FldPubStat != 100)
				mi_RetCode = 0;
			
			//@csharp - See last @csharp
			
			Cls2.Nest2FldAsmStat = 100;
			if(Cls2.Nest2FldAsmStat != 100)
				mi_RetCode = 0;
			
			Cls2.Nest2FldFoaStat = 100;
			if(Cls2.Nest2FldFoaStat != 100)
				mi_RetCode = 0;
			
			/////////////////////////////////
			// Test instance method access  
			if(Nested_Cls2.Nest2MethPubInst() != 100)
				mi_RetCode = 0;
			
			//@csharp - See last @csharp
			
			if(Nested_Cls2.Nest2MethAsmInst() != 100)
				mi_RetCode = 0;
			
			if(Nested_Cls2.Nest2MethFoaInst() != 100)
				mi_RetCode = 0;
			
			/////////////////////////////////
			// Test static method access
			if(Cls2.Nest2MethPubStat() != 100)
				mi_RetCode = 0;
			
			//@csharp - See last @csharp
			
			if(Cls2.Nest2MethAsmStat() != 100)
				mi_RetCode = 0;
			
			if(Cls2.Nest2MethFoaStat() != 100)
				mi_RetCode = 0;  
			
			/////////////////////////////////
			// Test virtual method access
			if(Nested_Cls2.Nest2MethPubVirt() != 100)
				mi_RetCode = 0;
			
			//@csharp - See last @csharp
			
			if(Nested_Cls2.Nest2MethAsmVirt() != 100)
				mi_RetCode = 0;
			
			if(Nested_Cls2.Nest2MethFoaVirt() != 100)
				mi_RetCode = 0;  
			
			////////////////////////////////////////////
			// Test access from within the nested class
			if(Nested_Cls2.Test() != 100)
				mi_RetCode = 0;
			
			return mi_RetCode;
		}
예제 #2
0
        public int Test_Nested(Cls2 Nested_Cls2)
        {
            int mi_RetCode = 100;

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

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

            //@csharp - Note, CSharp won't allow access of family or private members of a nested class...
            //from it's enclosing class.

            Nested_Cls2.Nest2FldAsmInst = 100;
            if (Nested_Cls2.Nest2FldAsmInst != 100)
            {
                mi_RetCode = 0;
            }

            Nested_Cls2.Nest2FldFoaInst = 100;
            if (Nested_Cls2.Nest2FldFoaInst != 100)
            {
                mi_RetCode = 0;
            }

            /////////////////////////////////
            // Test static field access
            Cls2.Nest2FldPubStat = 100;
            if (Cls2.Nest2FldPubStat != 100)
            {
                mi_RetCode = 0;
            }

            //@csharp - See last @csharp

            Cls2.Nest2FldAsmStat = 100;
            if (Cls2.Nest2FldAsmStat != 100)
            {
                mi_RetCode = 0;
            }

            Cls2.Nest2FldFoaStat = 100;
            if (Cls2.Nest2FldFoaStat != 100)
            {
                mi_RetCode = 0;
            }

            /////////////////////////////////
            // Test instance method access
            if (Nested_Cls2.Nest2MethPubInst() != 100)
            {
                mi_RetCode = 0;
            }

            //@csharp - See last @csharp

            if (Nested_Cls2.Nest2MethAsmInst() != 100)
            {
                mi_RetCode = 0;
            }

            if (Nested_Cls2.Nest2MethFoaInst() != 100)
            {
                mi_RetCode = 0;
            }

            /////////////////////////////////
            // Test static method access
            if (Cls2.Nest2MethPubStat() != 100)
            {
                mi_RetCode = 0;
            }

            //@csharp - See last @csharp

            if (Cls2.Nest2MethAsmStat() != 100)
            {
                mi_RetCode = 0;
            }

            if (Cls2.Nest2MethFoaStat() != 100)
            {
                mi_RetCode = 0;
            }

            /////////////////////////////////
            // Test virtual method access
            if (Nested_Cls2.Nest2MethPubVirt() != 100)
            {
                mi_RetCode = 0;
            }

            //@csharp - See last @csharp

            if (Nested_Cls2.Nest2MethAsmVirt() != 100)
            {
                mi_RetCode = 0;
            }

            if (Nested_Cls2.Nest2MethFoaVirt() != 100)
            {
                mi_RetCode = 0;
            }

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

            return(mi_RetCode);
        }