|
-
June 21st, 2010, 04:41 PM
#1
Object defined recursively?
Hi everyone,
I'm working on an object (a Barnes-Hut tree) that contains a body, an octant, and 8 additional BHTrees inside of it. I originally wrote the code in java, where this worked quite simply. But now, I'm getting an error for each of the fields: error: field 'bTNW' has incomplete type
Here's the code:
#ifndef BHTREE_H
#define BHTREE_H
#include <iostream>
#include <math.h>
#include "Body.h"
#include "Oct.h"
using namespace std;
class BHTree {
Body body;
Oct oct;
BHTree bTNW;
BHTree bTNE;
BHTree bTSW;
BHTree bTSE;
BHTree bBNW;
BHTree bBNE;
BHTree bBSW;
BHTree bBSE;
public:
void set_values (Oct q);
// bool isExternal(BHTree t);
// void insert(Body b);
// void updateForce(Body b, double t);
};
void BHTree::set_values(Oct q){
oct=q;
}
#endif
I imagine it has something to do with C++'s forward declarations that don't really apply in java to functions and classes, but I'm not sure. Any help would be appreciated!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|