# Author: James Tam # Version: Fall 2024 # Learning: # *Reinforcing scope (local variables) in an Object-Oriented program. # *Demonstrating the need for the self reference inside a class definition. class Person: def __init__(self,aName): self.name = aName def sayFriend(self,myFriend): print("Calling object's name %s" %(self.name)) print("name of friend is %s" %(myFriend.name)) def doesNotSetName(self,newName): #Unknown (stacey, jamie): not local, not attribute, not global stacey.name = newName jamie.name = newName def start(): stacey = Person("Stacey") jamie = Person("Jamie") stacey.sayFriend(jamie) #stacey.doesNotSetName(jamie) #print("What would the output be? Why?") #print(name) start()