I have 2 class(A & C) defined in a file allocate.h
and class B defined in work.h
.
I included allocate.h inside work.h file
My code looks like :
Class A{
}
Class C
{
public:
struct xyz{
A ob;
};
}
include"allocate.h"
Class C;
Class B{
void test(){
xyz obj; // `Error : error c2036 : xyz unknown size`
}
}
Can someone tell me how can i communicate the size of xyz structure in function test?
class
in C++ (which is case-sensitive) is all lower-case and the declarations end in semicolons. Please paste real code into your questions!
In this instance, xyz
is declared within the scope of class C
, so you'll need to specify the scope when you use it.
class B{
void test(){
C::xyz obj;
}
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.