옵션 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <iostream> #include <afxtempl.h> using namespace std; class Bird{ virtual bool isCanFly() = 0; }; class Chicken : public Bird{ bool isCanFly(){ return false; } }; class Pigeon : public Bird{ bool isCanFly(){ return true; } }; CList<Bird, Bird&> list; void AddList(const Bird &bird){ Bird newbird = bird; list.AddTail(newbird); } void main(){ Chicken chicken; Pigeon pigeon; AddList(chicken); AddList(pigeon); } |