我有以下類定義:子類模板類而無需實現純虛方法
template<typename QueueItemT>
class QueueBC
{
protected:
QueueBC() {}
virtual ~QueueBC() {}
private:
virtual IItemBuf* constructItem(const QueueItemT& item) = 0;
}
我創建了下面的子類:
class MyQueue
: public QueueBC<MyItemT>
{
public:
MyQueue() {}
virtual ~MyQueue() {}
};
這將編譯VS2005下細,但我在MyQueue
類中沒有實現constructItem()
。任何想法爲什麼?
如果你不能編譯這樣的代碼,那麼庫會有很多問題。 – Tom 2010-04-07 01:40:16
@湯姆 - 絕對!如果我在發佈之前再想幾秒鐘,我會意識到問題所在(我沒有在代碼中實例化對象)。 – LeopardSkinPillBoxHat 2010-04-07 23:51:06