我试图定义函数“getCurSize”,但由于某种原因,即使我在它下面定义它,它不会识别该定义,并以绿色下划线。 (初学者这里这么耐心赞赏)找不到函数定义?
template<class ItemType>
class FDHPolynomial
{
private:
FDHNode<ItemType>* headPtr;
int itemcount;
FDHNode<ItemType>* getPointedTo(const ItemType& nodenum) const;
public:
FDHPolynomial();
FDHPolynomial(const FDHPolynomial <ItemType>& aPoly);
virtual ~FDHPolynomial();
int getCurSize() const;
bool isEmpty() const;
bool add(const ItemType& newCoeffi, const ItemType& newExpon);
bool remove(const ItemType& anExpon);
void clear();
bool contains(const ItemType& aExpon) const;
ItemType degree() const;
ItemType coefficient(const ItemType& power) const;
void changeCoefficient(const ItemType& newCoeffi, const ItemType&power);
std::vector<ItemType> toVector() const;
void print();
};
template<class ItemType>
int Polynomial<ItemType>::getCurSize() const
{
return itemCount;
}
'多项式 :: getCurSize()' - >'FDHPolynomial :: getCurSize()' –