W
Wonlay
//file1.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
A a;
static void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B::test ();
}
//error: the left of .i .j should be a struct/class/union.
//file2.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
static A a;
void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B b;
b.test ();
}
//error link2001:
//fatal error link1120: 1
//file3.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
static A a;
static void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B::test ();
}
//the same error with file2.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
A a;
static void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B::test ();
}
//error: the left of .i .j should be a struct/class/union.
//file2.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
static A a;
void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B b;
b.test ();
}
//error link2001:
//fatal error link1120: 1
//file3.cpp
#include <stdio.h>
class A
{
public:
int i;
int j;
A ()
{
i = 1;
j = 2;
}
};
class B
{
public:
static A a;
static void test ()
{
printf ("%d, %d", a.i, a.j);
}
};
void main ()
{
B::test ();
}
//the same error with file2.cpp