# Author: james tam # Version: Dec. 3, 2023 # Learning: how to access class atttributes and methods outside of the class # definition class Person: def __init__(self): self.name = "no name" def getName(self): return(self.name) def getName(): return("Calling function not method") def start(): bart = Person() lisa = Person() #Variable/reference needed outside function to: #1) fullfill syntax requirements: methods are called via reference and dot-operator bart.name = "I'm Bart Simpson who the heck are you?" lisa.name = "My name is Lisa" print(bart.getName()) print(lisa.getName()) print(getName()) start()