Hello, I have a question regarding the way intellisense works with ref classes. I have a class like so:
public ref class Man abstract sealed
{
public:
public ref class Size
{
public:
static int Height;
static int Weight;
};
public ref class Name
{
public:
static String^ First_Name;
static String^ Last_Name;
static String^ Middle_Name;
};
public ref class Colour
{
public:
static Color^ SkinColour;
static Color^ EyesColour;
};
};
Now I created a new instance of Man called m. then I typed m-> but
intellisense doesn't see the classes inside it, if I use them in my
code it works, though. Also, if I write Man:: I see all of the classes
inside. Why is this
With Thanks,
Gal Beniamini.

Ref Class Question
Kang Su
Hmm... no problem... but what are you trying to do in fact
ref class C1
{
public:
ref class NC1
{
public:
static int s1;
int m1;
String ^m2;
};
NC1 ^mnc1;
static int s2;
};
With this you can write the following:
C1 ^c = gcnew C1; // create an instance of the C1 class
c->mnc1 = gcnew C1::NC1; // create an instance of the C1::NC1 class
c->mnc1->m2 = "2"; //access of the m1 instance field of the C1::NC1 class
C1::NC1::s1 = 2; // access of the s1 static field of the C1::NC1 class
C1::s2 = 3; // access of the s2 static field of the C1 class
Yutong MSFT
chris_m_willis
JHorn
With Thanks,
Gal Beniamini.
wonderliza
No. You cannot access the neste classes using ->. I suspect what you really want is not to access the neste class but some instances of them:
public ref class Man abstract sealed {
...
Size ^size;
Name ^name;
Colour ^colour;
}
Now you can write something like m->size, m->name, m->colour.
What I don't understand is why you have declared all the members of the nested classes as static. Is this really what you intended
Ken England
With Thanks,
Gal Beniamini.