IsFullのインターフェースがうまく書けません。
templateが原因だとは思うのですが、
そのどうなインターフェースを書けばいいでしょうか?
ご指摘よろしくお願いします。
/* * StackType.cpp * * Created on: 2015/12/01 * Author: 礼央 */ #include "StackType.h" #include"ItemType.h" template<class ItemType> StackType<ItemType>::StackType(int max) { maxStack=max; top=-1; items=new ItemType[maxStack]; } template<class ItemType> StackType<ItemType>::StackType() { maxStack=500; top=-1; items=new ItemType[maxStack]; } template<class ItemType> bool StackType<ItemType>::IsFull() const{ return(top==maxStack-1); }
コード/* * StackType.h * * Created on: 2015/12/01 * Author: 礼央 */ #ifndef STACKTYPE_H_ #define STACKTYPE_H_ #include"ItemType.h" template<class itemType> class StackType { public: StackType(int max); StackType(); bool IsFull() const private: int top; int maxStack; ItemType*items; }; #endif /* STACKTYPE_H_ */
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/12/01 01:46