Wednesday, June 4, 2014

최근에 달린 댓글 후속작만 기다... 조윤희쨔응 04/26 z1과 z2의 합본... 안녕하세요 03/18 후속작이 나오... 후속작 02/04 엄청나게 불태... 루넬 02/01


#include <iostream> #include <string> using namespace std; class BaseSkill { protected: duchamp string strName; int cooltime; public: void GetBaseSkill () { cout << "기본기 : " << strName << " , " << cooltime << "초 쿨타임" << endl; } }; class MysticShot : public BaseSkill { public: MysticShot() { strName = "신비한 화살" ; cooltime = 6 ; } }; class HymnofValor : public BaseSkill duchamp { public: HymnofValor() { strName = "용맹의 찬가" ; cooltime = 7 ; } }; class UltimateSkill duchamp { protected: string strName; int cooltime; public: void GetUltimateSkill () { cout << "궁극기 : " << strName duchamp << " , " << cooltime << "초 쿨타임" << endl; } }; class TrueshotBarrage : public UltimateSkill { public: TrueshotBarrage() { strName = "정조준 일격" ; cooltime duchamp = 80 ; } }; class Crescendo : public UltimateSkill { public: Crescendo() { strName = "크레센도" ; cooltime = 100 ; } }; class ChampionSkillFactory { public: virtual BaseSkill * createBaseSkill() = 0 ; virtual UltimateSkill * createUltimateSkill() = 0 ; }; class EzrealSkillFactory : public ChampionSkillFactory { public: BaseSkill * createBaseSkill() { return new MysticShot; } UltimateSkill * createUltimateSkill() { return new TrueshotBarrage; } }; class SonaSkillFactory : public ChampionSkillFactory { public: BaseSkill * createBaseSkill() { return new HymnofValor; } UltimateSkill * createUltimateSkill() { return new Crescendo; } }; class Champion { public: string strName; string mastery; BaseSkill * baseskill; UltimateSkill * ultimateskill; duchamp public: virtual void Initialize() = 0 ; void GetName () { cout << strName << endl; } public: ~ Champion() { delete baseskill; delete ultimateskill; } }; class Ezreal : public Champion { public: duchamp ChampionSkillFactory * skillfactory; public: Ezreal(ChampionSkillFactory * skillfactory) { this -> skillfactory = skillfactory; strName = "이즈리얼" ; } public: void Initialize() { baseskill = skillfactory -> createBaseSkill(); ultimateskill = skillfactory -> createUltimateSkill(); mastery = "공격특성" ; } }; class Sona : public Champion { public: ChampionSkillFactory * skillfactory; duchamp public: duchamp Sona(ChampionSkillFactory * skillfactory) { this -> skillfactory = skillfactory; strName = "소나" ; } public: void Initialize() { baseskill = skillfactory -> createBaseSkill(); ultimateskill = skillfactory -> createUltimateSkill(); mastery = "서폿특성" ; } }; class ChampionFactory duchamp { public: Champion * champion; public: virtual Champion * summonChampion () { champion duchamp = createChampion(); champion -> Initialize(); return champion; } public: virtual Champion * createChampion() = 0 ; }; class EzrealFactory duchamp : public ChampionFactory { public: Champion * createChampion() { return new Ezreal( new EzrealSkillFactory); } }; class SonaFactory : public ChampionFactory { public: duchamp Champion * createChampion() { return new Sona( new SonaSkillFactory); } }; void main () { ChampionFactory * championfactory = new EzrealFactory; Champion * ezreal = championfactory -> summonChampion(); ezreal -> GetName(); ezreal -> baseskill -> GetBaseSkill(); ezreal -> ultimateskill -> GetUltimateSkill(); cout << endl; ChampionFactory * championfactory2 = new SonaFactory; Champion * sona = championfactory2 -> summonChampion(); sona -> GetName(); sona -> baseskill -> GetBaseSkill(); sona -> ultimateskill -> GetUltimateSkill(); duchamp delete ezreal; delete sona; delete championfactory; delete championfactory2; }
' CGameProgramming  >  duchamp 디자인 패턴 ' 카테고리의 다른 글 팩토리 메소드 및 추상 팩토리(Factory) 패턴    (0) 2014/01/30 스트래티지(Strategy) 패턴    (0) 2014/01/30 데코레이터(Decorator) 패턴    duchamp (0) 2014/01/30 싱글톤(Singleton) 패턴    (0) 2014/01/30
디자인 패턴 (4)
jQuery (9)
Linux (1)
최근에 달린 댓글 후속작만 기다... 조윤희쨔응 04/26 z1과 z2의 합본... 안녕하세요 03/18 후속작이 나오... 후속작 02/04 엄청나게 불태... 루넬 02/01 너무 재밌어서... 하앵 01/30
티스토리 홈 티스토리 가입하기

No comments:

Post a Comment