C++多继承注意事
虚基类派生虚基类
template<class K, class E>
class bsTree : public dictionary<K, E>
{
public:
virtual void ascend() = 0
};
template<class K, class E>
class dictionary
{
public:
virtual ~dictionary() {}
virtual bool empty() const = 0;
// return true iff dictionary is empty
virtual int size() const = 0;
// return number of pairs in dictionary
virtual pair<const K, E>* find(const K&) const = 0;
// return pointer to matching pair
virtual void erase(const K&) = 0;
// remove matching pair
virtual void insert(const pair<const K, E>&) = 0;
// insert a (key, value) pair into the dictionary
};
单继承
//二叉树的数据结构
template <class T>
struct binaryTreeNode
{
T element;
binaryTreeNode<T>* leftChild, // left subtree
*