I am new to c++
. I have a class called QuadTree
. Now QuadTree
can contain array of 4 other QuadTree
. Either they all have values or they all will be null. So in my class header file QuadTree.h
is as below.
class QuadTree
{
public:
QuadTree();
~QuadTree();
void Clear();
private:
QuadTree nodes_[4];
};
but this nodes_ declaration show error that
'incomplete type is not allowed'.
I have also tried
QuadTree* nodes_[4];
then when I initialize in constructor
nodes_ = new QuadTree[4];
It gives me error 'expression must be a modifiable value'.
I can declare that as list or something. but it's size is constant(always 4). So I want to use array. Please help me to declare in header file and how to initialize in constructor in QuadTree.cpp
file.