[英]how can I define a function of a derived template class?
我正在嘗試從class FHhashQPwFind
定義函數查找。 你能告訴我我在做什么錯嗎?
我把“ HERE IS THE ERROR”寫在了編譯器說的地方:
錯誤:模板參數的數量錯誤(1,應為2)
template <class Object, typename KeyType>
class FHhashQPwFind: public FHhashQP<Object>
{
public:
const Object find(const KeyType & key);
protected:
int myHashKey(const KeyType & key) const;
int findPosKey( const KeyType & key ) const;
};
template <class Object, typename KeyType>
const Object FHhashQPwFind<Object>::find(const JeyType & key)//HERE IS THE ERROR
{
}
我一定會嘗試
const Object FHhashQPwFind<Object, KeyType>::find(const KeyType & key)
還要注意在模板參數JeyType
其命名為JeyType
。
該錯誤是因為您的方法被聲明為
FHhashQPwFind<Object>
需要第二個參數KeyType時:
FHhashQPwFind<Object, KeyType>
編寫方法時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.