Plan Instance Methods
00:00 The next step is to model three methods for each of these classes. Or I could also model three methods on a parent class and then just have all of the child classes use them. So I think that’s what I’m going to do.
00:12
I’m going to model three methods and then maybe some individual ones for the child classes. We’ll see. So what do I want my animals to be able to do? They should be able to .eat()
.
00:26 That’s helpful. And then maybe we give them some food as an input here. I’m not sure yet if I want them to decide what they eat.
00:37
What else? They should be able to .move()
to a location
00:44
maybe, and then also to .talk()
and say a sound. We’ve done that one often.
00:55 So maybe these three methods, they kind of make sense. I’m not entirely sure. I want to actually model food objects. I am going to do location objects for sure.
01:05
This one’s going to be interesting, the .move()
method. That’s because it’s actually going to require me to also have locations where they can move to.
01:12
So I will probably keep this one until the end and first model the farm locations as well. But let’s start with .talk()
, because we’ve done that one before and that’s also going to be different for each of the child classes.
Become a Member to join the conversation.