C++相談室 part62 ..
[2ch|▼Menu]
821:デフォルトの名無しさん
08/07/17 22:57:57
>>819
テンプレートクラスを使わずに普通のクラスで対処したらいけないの?

class list { /* listの定義 */ };;
class IntegerList : public list { /* IntegerListの定義 */ };
class DoubleList : public list { /* DoubleListの定義 */ };

list* getList(int n) {
    if ( n == 1 ) { return new IntegerList(); }
    if ( n == 2 ) { return new DoubleList(); }
}


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

4766日前に更新/209 KB
担当:undef