[Tutor] Class Construction question
Chris Davidson
cxd401@psu.edu
Mon Nov 11 19:05:01 2002
Hello everyone,
I have a question, which I hope is not real stupid, but here goes
anyway. I am trying to construct some classes and I am starting with a
real basic Person class. Which holds name, address, and telephone
number. Here is what I have so far:
class Person:
def setPhone(self, string):
self.PhoneNumber = string
def setName(self, string):
self.FirstName = string
def getName(self):
return self.FirstName
def getPhoneNumber(self):
return self.PhoneNumber
I am going from examples I have picked up, so i don't know if this is
truly right. But when i try to use it in some example code it just
hangs. Here is the code i am testing it out with. This code is in the
same file as the Class also.
testing = Person()
print "Hello"
testing.setName("Chris")
print testing.getName()
Any pointers, harassment, or suggestions would be cool.
Thanks ahead of time for the help,
Chris