If I have a class lets call it BT. And class BST inherits BT. And then class AVL inherits class BST. Can AVL use the functionality of BST and BT? And if it can how would I go about doing that.
The errors look something like this.
test_avl.cpp:(.text._ZN3BSTIiED2Ev[BST<int>::~BST()]+0xd): undefined reference to `BT<int>::~BT()'
I am not calling the destructor but it is called automatically. But anytime I try to call a function in BST or BT it gives me an undefined reference to...
I think that it is just syntax that I don't know, I don't think there is anything wrong with the code other than that.
template<typename generic>
class BST : public BT<generic>
{
public:
void insert(generic x);
void remove(generic x);
typedef BTPreorderIterator<generic> PreOrder;
typedef BTInorderIterator<generic> InOrder;
typedef BTPostorderIterator<generic> PostOrder;
PreOrder pre_search(generic x);
InOrder in_search(generic x);
PostOrder post_search(generic x);
protected:
BTN<generic>* p_insert(generic x); // returns a pointer to the new node
BTN<generic>* p_remove(generic x); // returns a pointer to the parent of the deleted node
BTN<generic>* p_search(generic x); // returns a pointer to where x is found
private:
BTN<generic>* kill(BTN<generic>* x);
using BT<generic>::m_size;
using BT<generic>::m_root;
};
Yes my teacher gave us a .a file that has all the functions for BT and BST. But that must be the problem though because I don't see what else could be.
It's too late for that. It is due at 4 AM. But he said it won't compile when we submit it because of the way we have to submit it. Hopefully my code is right without having to test it so I can get a decent grade on it.