mickey
9th November 2007, 11:45
//node.h
class Node : public Interval {
Node* _left;
Node* _right;
Node* _parent;
int _max;
};
//myTree.cpp
void myTree::createTree (vector<Interval>* vec) {
for (int i=0; i < (int) (*vec).size() ; ++i) {
appendNode ( &(*vec)[i] );
}
void Tree::appendNode(Node* node) { }
//main.cpp
vector<Interval> listInterval;
(listInterval).push_back(Interval (10,12));
listInterval.push_back(Interval (20,25));
listInterval.push_back(Interval (30,40));
listInterval.push_back(Interval (50,88));
tree->createTree(&listInterval);
I passed a vector to create tree and then for each element I call append node; but I don't know hoe can I pass it to appendNode; in that way compiler get error.
I have to convert Interval to Node for obvious reansons.. when I create the intervals, then they must be contained in then nodes
Any suggests do to this, please? thank you!
class Node : public Interval {
Node* _left;
Node* _right;
Node* _parent;
int _max;
};
//myTree.cpp
void myTree::createTree (vector<Interval>* vec) {
for (int i=0; i < (int) (*vec).size() ; ++i) {
appendNode ( &(*vec)[i] );
}
void Tree::appendNode(Node* node) { }
//main.cpp
vector<Interval> listInterval;
(listInterval).push_back(Interval (10,12));
listInterval.push_back(Interval (20,25));
listInterval.push_back(Interval (30,40));
listInterval.push_back(Interval (50,88));
tree->createTree(&listInterval);
I passed a vector to create tree and then for each element I call append node; but I don't know hoe can I pass it to appendNode; in that way compiler get error.
I have to convert Interval to Node for obvious reansons.. when I create the intervals, then they must be contained in then nodes
Any suggests do to this, please? thank you!