class AddrBookEntry(object):
def __init__(self, nm, ph):
self.name = nm
self.phone = ph
print 'Created instance for:', self.name
def updatePhone(self, newph):
self.phone = newph
print 'Updated phone# for:', self.name
john = AddrBookEntry('A', '000-555-1212')
jane = AddrBookEntry('B', '111-555-1212')
print john
print john.name
print john.phone
print jane.name
print jane.phone
john.updatePhone('111-555-1212')
print john.phone
|