Create Location Classes
So I’ll assign
self.spaces to the value of the argument that you’ll have to pass in when creating a
FarmLocation instance. Then it should have a space to hold animals, but this is not really something that we need to pass as an argument.
So this again, is going to be an instance attribute
self.animals, but I don’t need to pass it in. So I’m just going to make this a list, an empty list object here, so that each instance of
FarmLocation is going to have its own list that then I can somehow fill up with animal objects up to a certain amount until it hits the limit of spaces that this specific instance has.
And just for the fun of it, I’m thinking it could be nice to have some sort of
.location_type also for farm locations, but to show you like how you can do things differently in OOP, I’m going to model it a bit differently for the farm locations.
Become a Member to join the conversation.