13. Override! <---- help understanding methods' arguments



hi, I have the following doubts:

1) what does 'other.name' mean?
2) I'm not understanding why are they giving variables as arguments to the methods used. For example in: 'emp.greet(ceo)' the variable 'ceo' is an instance of the Employee class, right? I can't understand why are they giving 'ceo' as its argument.

Thanks in advance to anyone willing to help a novice python programmer!

Replace this line with your code.


other is the instance that is accessing this method, other than self.

ceo = CEO("Emily")
emp = Employee("Steve")
emp.greet(ceo)    # note that the `ceo` instance is passed to `emp.greet` method
# Hello, Emily
ceo.greet(emp)    # note that the 'emp` instance is passed to `ceo.greet` method.
# Get back to work, Steve!

In borh cases above, one instance uses the method of another instance.

This should now be a little more clear. If you are still having a problem understanding let us know and we can dig around for some documentation.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.