我已经定义了一个类
template <class T> class NodeMap {
NodeMap(int n, T defaultEntry = NULL);
virtual ~NodeMap();
T& operator[](const node& u);
...
}
它将一个类型的对象映射node到一个参数类型的对象T。
现在我想要一个类Matching,它本质上是一个NodeMap<node>. 为方便起见,我想添加isProperMatching(Graph& G)和之类的方法match(node u, node v)。可以Matching继承自NodeMap<node>?是否可以(如果可以,这是一个好主意)扩展具有固定模板参数的模板类吗?