BeesBeesBees
가장 고귀한 곤충인 꿀벌은, 일생동안 특정 발달 단계를 하나하나 거칩니다.
각 단계에는 꿀벌이 갖는 고유한 특징과 작동이 있습니다.
이 repository에는 다양한 종류의 꿀벌 Class가 존재합니다.
각 단계별로 꿀벌 Class가 있고, 이를 통해 pseudoclassical 패턴 및 ES6 class keyword를 이용한 상속을 배우게 됩니다. (상속은 종종 subclassing 이라고 표현합니다) 어떻게 꿀벌 클래스를 만들어야하는지는 아래 내용을 참고하세요!
BeesBeesBees의 목적
Inheritance Implementation , ES6, Pseudoclassical keywords 를 이용한 상속구현
시작전 다음과 같은 것을 확인해야 했다.
npm install을 통해 dependency를 설치하세요. |
Class Structure
├── Grub │
└── Bee │
├── HoneyMakerBee │
└── ForagerBee
위의 class structure에서 볼 수 있듯이 모든 Bee는 Grub을 기반으로 하여 각자의 특성에 맞는 일을 받게 됩니다.
공통된 특성을 기반으로 각자에게 맞는 특성을 부여받을 수 있는것은 상속이 이루어졌음을 의미합니다.
Grub
- Create a Grub class, in ES6 style, with:
- an age property that is set to 0 (0으로 설정된 연령 속성)
- a color property that is set to pink (핑크빛으로 설정된 색채 특성)
- a food property that is set to jelly ( 젤리처럼 굳어진 식량 재산)
- an eat method that returns 'Mmmmmmmmm jelly' ( 'Mmmm젤리'를 돌려주는 식사법)
Bee
- Create a Bee class, in ES6 style, with:
- the Grub superclass ( super 객체 사용 )
- an age property that is set to 5 ( 5세로 정해진 연령의 재산 )
- a color property that is set to yellow ( 노란색으로 설정된 색 속성 )
- a food property that is inherited from grub ( 밭에서 물려받은 식량 재산)
- an eat method that is inherited from grub ( grub에서 유전되는 식사법 )
- a job property that is set to Keep on growing ( 계속 성장하기로 되어 있는 직업 재산 )
HoneyMakerBee
- Create a HoneyMakerBee class, in ES6 style, with:
- the Bee superclass
- an age property that is set to 10 ( 10로 정해진 연령의 재산 )
- a job property that is set to make honey ( 꿀을 만들도록 설정된 직업 재산 )
- a color property inherited from bee that is set to yellow ( 벌로부터 물려받은 누런 색의 성질 )
- a food property that is inherited from grub ( 밭에서 물려받은 식량 재산 )
- an eat method that is inherited from grub ( grub에서 유전되는 식사법 )
- a honeyPot property that is set to 0 ( 0으로 설정된 honeypot 속성 )
- a makeHoney method that adds 1 to that honeyBee's honeyPot ( 그 꿀벌에 honeypot에 1을 더하는 makeHoney 방법 )
- a giveHoney method that subtracts 1 from that honeyBee's honeyPot ( 1을 빼는 honey method )
ForagerBee
- Create a ForagerBee class, in ES6 style, with:
- the Bee superclass
- an age property that is set to 10 ( 10세로 정해진 연령의 재산 )
- a job property that is set to find pollen ( 꽃가루를 찾기 위해 마련된 직업 재산 )
- a color property inherited from bee that is set to yellow ( 벌로부터 물려받은 누런 색의 성질 )
- a food property that is inherited from grub ( 밭에서 물려받은 식량 재산 )
- an eat method that is inherited from grub ( grub에서 유전되는 식사법 )
- a canFly property that is set true ( 참으로 설정된 canFly 속성 )
- a treasureChest property that is set to an empty array [] ( 보물빈 배열로 설정된 체스트 속성[] )
- a forage method that allows the bee to add a treasure to the treasureChest ( 벌이 보물에 보물을 더할 수 있는 포경법 체스트 )
HTML& CSS - 웹사이트 하나를 그대로 클론해보기
Subclass Dance Party
Event handling, UI , Inheritance, Object Interaction
상속을 통해 구현한 객체를 직접 화면 표시하고 각자 화면에 이벤트를 걸어 화면에 표현해보자.
선배들이 한거 디아블로 사냥, 배틀그라운드 사냥
'Codestates > Full IM' 카테고리의 다른 글
Algorithms (0) | 2020.08.03 |
---|---|
Subclass Dance Party (0) | 2020.07.30 |
Inheritance patterns (0) | 2020.07.30 |
Understanding Prototype Chain (0) | 2020.07.29 |
Object Oriented Programming + Instantiation (0) | 2020.07.29 |