Add a Non-Public Attribute
Previously, I just revised my draft and I said, I’m going to kick out
.exit(). So I will not actually implement
.exit() on farm locations, but instead I’m going to make sure that I can do the movement of the animal from the
.move() method inside of the
And here we are on line 64 for me is the
.move() method where there’s nothing implemented yet, but I already have access to instances, an instance method, and then also as a second attribute,
I want to be able to store the location that an animal currently is at. And for that, I will add a new instance attribute that I’ll call
self._location. Again, I’m making this a non-public attribute because, well, I don’t really necessarily want this object, the
FarmLocation object, to be visible directly to a user.
00:54 I’m not a hundred percent sure I’m going to stick with that, but that’s kind of my feeling for now. I want this to be a non-public attribute. I can always change it later if that turns out not to make sense.
Let’s see how we can implement that in
.move(). Let’s draft up what do I need to keep track of here because there’s a couple of things going on. Now, I’m assuming that this
location argument that I’m passing into
.move() is going to be the reference to a location object, either a
Field or a
Barn in these cases, but could be any child instance of a
Become a Member to join the conversation.