#include "stdafx.h"
using namespace System;
ref class OutterClass
{
public:
ref class NestedClass // nested class
{
public:
int publicMember;
protected:
int protectedMember;
private:
int privateMember;
};
NestedClass^ protectedNC; // protected variable reference to NestedClass
private:
NestedClass^ privateNC;
public:
NestedClass^ publicNC;
OutterClass() : publicNC(gcnew NestedClass),protectedNC(gcnew NestedClass),privateNC(gcnew NestedClass)
{}
void method()
{
int x;
NestedClass nc1;
x = nc1.publicMember;
x = publicNC->publicMember;
x = protectedNC->publicMember;
x = privateNC->publicMember;
}
};
ref class inheritOutterClass : public OutterClass{
public:
void method(){
int x;
NestedClass nc1;
x = nc1.publicMember;
x = publicNC->publicMember;
x = protectedNC->publicMember;
}
};
void main()
{
OutterClass sc;
int x = sc.publicNC->publicMember;
}