T
thomas
-------------code------------
class A{
public:
A(){}
void f(){
B *b = new B();
}
};
class B{
public:
B(){}
void f(){
A *a = new A();
}
};
---------------code------------
for the above sample code, there's compile error.
if I put a declaration "class B;" at the begining, it says that no
default constructor.
how to declare a default constructor to avoid the compile error?
class A{
public:
A(){}
void f(){
B *b = new B();
}
};
class B{
public:
B(){}
void f(){
A *a = new A();
}
};
---------------code------------
for the above sample code, there's compile error.
if I put a declaration "class B;" at the begining, it says that no
default constructor.
how to declare a default constructor to avoid the compile error?