Inheritance...

KraftDiner bobrien18 at yahoo.com
Fri Oct 14 16:06:28 EDT 2005


I have a base class

class geometry(object):
   def __init__(self):
      self.blue = 1
      self.red = 2
   def render(self):
      pass

class square(geometry):
    def __init__(self):
         super(square, self).__init__()
   def render(self)
      print 'square'

class circle(geometry):
    def __init__(self):
         super(square, self).__init__()
   def render(self)
      print 'square'

objLst = []
objLst.append(square())
objLst.append(circle())

for obj in objLst:
   obj.render()
print obj.blue

What is wrong with this... I will not print blue... (1)




More information about the Python-list mailing list