【初心者歓迎】C/C++室 Ver.39【環境依存OK】 at TECH
[2ch|▼Menu]
589:デフォルトの名無しさん
07/07/07 11:29:17
>>586
あるよ。ほら。
template<typename T>class size
{
T width_;
T height_;
public:
size() : width_(), height_() {}
size(T width, T height) : width_(width), height_(height) {}
size(const size & foo) : width_(foo.width()), height_(foo.height()) {}
size & operator=(const size & foo) {width_ = foo.width(); height_ = foo.height(); return * this;}

bool operator==(const size & foo) const {return width() == foo.width() && height() == foo.height();}
T width() const {return width_;}
T height() const {return height_;}
T area() const {return width() * height();}
};
今作ったからバグってるかも知れないけど。


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

4839日前に更新/194 KB
担当:undef