loupus
January 24th, 2010, 11:43 AM
I am new to c++/cli. I looked for several forums but couldnt find a relative answer for my problem. Here, below, two classes in the same namespace. Compiler gives the following error message:
error C2065: 'classA' : undeclared identifier.
When I put the classA before classB it works fine. What is the logic behind this? Is there any way writing classes free from writing sequence?
public ref class classB
{
String^ _b;
public:
void somefunc(){
classA^ clsa = gcnew classA("some string",12);
}
};
public ref class classA
{
private:
Int32 portu;
String^ hostu;
public:
classA(String^ phostu, Int32 pportu)
{
hostu = phostu;
portu = pportu;
}
};
error C2065: 'classA' : undeclared identifier.
When I put the classA before classB it works fine. What is the logic behind this? Is there any way writing classes free from writing sequence?
public ref class classB
{
String^ _b;
public:
void somefunc(){
classA^ clsa = gcnew classA("some string",12);
}
};
public ref class classA
{
private:
Int32 portu;
String^ hostu;
public:
classA(String^ phostu, Int32 pportu)
{
hostu = phostu;
portu = pportu;
}
};