本文共 859 字,大约阅读时间需要 2 分钟。
为了演示以下16个,用了下面32行代码。
iterator,adapter,interpreter,,state,visitor,command,bridge,chain of responsibility,composite,flyweight,strategy,decorator,mediator,memento,observervoid main(){ for(i=0;i<2;i++){ if (i==0){Actor getUpActor=new GetUpActor(); getUpActor.Action(); delete getUpActor;} else if(i==1){Actor supperActor=new SupperActor(); supperActor.Action(); delete supperActor;}}class Actor(){ public: virtual void Action()=0;protected:Actor();};class GetUpActor():public Actor{ public: virtual void Action(); GetUpActor();};void GetUpActor:Action{ cout<}class SupperActor():public Actor{ public:virtual void Action(); SupperActor();};void SupperActor():Action{ cout<}来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10748419/viewspace-1008735/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10748419/viewspace-1008735/