예제 #1
0
    public int Test_Nested(Cls Nested_Cls)
    {
        int mi_RetCode = 100;

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

        /////////////////////////////////
        // Test instance field access
        Nested_Cls.NestFldPubInst = 100;
        if (Nested_Cls.NestFldPubInst != 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_Cls.NestFldAsmInst = 100;
        if (Nested_Cls.NestFldAsmInst != 100)
        {
            mi_RetCode = 0;
        }

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

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

        //@csharp - See last @csharp

        Cls.NestFldAsmStat = 100;
        if (Cls.NestFldAsmStat != 100)
        {
            mi_RetCode = 0;
        }

        Cls.NestFldFoaStat = 100;
        if (Cls.NestFldFoaStat != 100)
        {
            mi_RetCode = 0;
        }

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

        //@csharp - See last @csharp

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

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

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

        //@csharp - See last @csharp

        if (Cls.NestMethAsmStat() != 100)
        {
            mi_RetCode = 0;
        }

        if (Cls.NestMethFoaStat() != 100)
        {
            mi_RetCode = 0;
        }

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

        //@csharp - See last @csharp

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

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

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

        return(mi_RetCode);
    }
예제 #2
0
파일: L-1-4-1.cs 프로젝트: CheneyWu/coreclr
	public int Test_Nested(Cls Nested_Cls)
	{
		int mi_RetCode = 100;
		
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		// ACCESS NESTED FIELDS/MEMBERS
		/////////////////////////////////////////////////////////////////////////
		/////////////////////////////////////////////////////////////////////////
		
		/////////////////////////////////
		// Test instance field access
		Nested_Cls.NestFldPubInst = 100;
		if(Nested_Cls.NestFldPubInst != 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_Cls.NestFldAsmInst = 100;
		if(Nested_Cls.NestFldAsmInst != 100)
			mi_RetCode = 0;
		
		Nested_Cls.NestFldFoaInst = 100;
		if(Nested_Cls.NestFldFoaInst != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static field access
		Cls.NestFldPubStat = 100;
		if(Cls.NestFldPubStat != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		Cls.NestFldAsmStat = 100;
		if(Cls.NestFldAsmStat != 100)
			mi_RetCode = 0;
		
		Cls.NestFldFoaStat = 100;
		if(Cls.NestFldFoaStat != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test instance method access  
		if(Nested_Cls.NestMethPubInst() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Nested_Cls.NestMethAsmInst() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethFoaInst() != 100)
			mi_RetCode = 0;
		
		/////////////////////////////////
		// Test static method access
		if(Cls.NestMethPubStat() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Cls.NestMethAsmStat() != 100)
			mi_RetCode = 0;
		
		if(Cls.NestMethFoaStat() != 100)
			mi_RetCode = 0;  
		
		/////////////////////////////////
		// Test virtual method access
		if(Nested_Cls.NestMethPubVirt() != 100)
			mi_RetCode = 0;
		
		//@csharp - See last @csharp
		
		if(Nested_Cls.NestMethAsmVirt() != 100)
			mi_RetCode = 0;
		
		if(Nested_Cls.NestMethFoaVirt() != 100)
			mi_RetCode = 0;  
		
		////////////////////////////////////////////
		// Test access from within the nested class
		if(Nested_Cls.Test() != 100)
			mi_RetCode = 0;
		
		////////////////////////////////////////////
		// Test accessing the second nested class
		if(Test_Nested2(Nested_Cls.Cls2PubInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested2(Nested_Cls.Cls2AsmInst) != 100)
			mi_RetCode = 0;
		
		if(Test_Nested2(Nested_Cls.Cls2FoaInst) != 100)
			mi_RetCode = 0;

		return mi_RetCode;
	}