不能预览其他用户文档
算法与数据结构 9.1.2集合类 我们可以定义一个集合类。定义这个类主要是为了说明各种实现集合的数据结构都应当具有的操作。这个类里没有为集合的实现而设置的内部数据结构,因此也就不需要构造函数和析构函数。 template class T class set { public: virtual int isEmpty(void) const = 0; virtual int includes (const T val) const = 0; virtual void add (const T val) = 0; virtual void remove (const T val) = 0; ? void intersectWith (const setT) {}; void unionWith (const setT) {}; void differenceFrom (const setT) {}; int subset (const setT) { return 0; }; int operator == (const setT) { return 0; }; }; 类9.1 集合类 我们无法把set中的方法都定义为纯虚函数,因为在实现集合操作的成员函数里都包含了对集合类的实例对象的引用参数。这种
原创力文档

文档评论(0)