# This defines a Person class, and a subclass of Person called Student.
# Note that class Student inherits the SetAge method from class Person.
# Student also inherits __str__ from class Person, but this method it
# overrides (by giving its own version).
class Person:
    def __init__(self, name):
        self.name = name
        self.age = 0

    def SetAge(self, a):
        self.age = a

    def __str__(self):
        return "%s is %d years old" %(self.name, self.age)

class Student( Person ):
    def __init__(self, name):
        Person.__init__(self, name)
     #   self.name = name
     #   self.age = 0
        self.year = "Freshman"
        self.age = 18

    def SetYear(self, y):
        self.year = y

    def __str__(self):
        return "%s, an %d year old %s"%(self.name, self.age, self.year)

    def PrintAsPerson(self):
        print( Person.__str__(self) )

    
        
def main():
    L = []
    x = Person( "Bob" )
    x.SetAge(64)
    L.append(x)

    y = Student("Mary")
    y.SetAge( 20 )
    y.SetYear( "Junior" )
    L.append(y)
    z = Student( "Neville" )
    L.append(z)
    
    for p in L:
        print(p)

    z.PrintAsPerson()
main()









    

        
