Challenge: Modeling a Farm
00:00 So as always, if you don’t practice it, you don’t really understand it. It’s all fine and well to watch slides and nod and say, yeah, yeah, that makes sense. But until you actually have to write it yourself from scratch, things don’t really click. Your challenge is to model a farm.
You don’t want to let things go ahead of yourself, but you do want to try and use all the tools that you’ve learned so far. So here’s a suggestion. Model four classes, say one
Animal class and then three classes that inherit from
Each class should have a few attributes and at least one method, maybe making sounds, eating, sleeping. Maybe they should be variations for the classes that inherit from the
Animal class. Then try and model two more classes, maybe a
Field, maybe a
Then make these places have an attribute where they can store
Animal objects. So you’re starting to model a farm where you may have cows in one field and then you move them to the barn, and maybe the barn already has some pigs and some horses.
Become a Member to join the conversation.