Question about inheritance...

KraftDiner bobrien18 at yahoo.com
Sat Oct 22 21:25:31 EDT 2005


This is what I've got so far:
class Shape(object):
	def __init__(self):
		pass
	def render(self):
		print 'Shape render'
		self.outline()
	def outline(self):
		pass

class Rect(Shape):
	def __init__(self):
		super(self.__class__, self).__init__()
	def render(self):
		super(self.__class__, self).render()
	def outline(self):
		print 'Rect outline'

r = Rect()
r.render()

The output:

Shape render
Rect outline

Cool.. I guess its working..




More information about the Python-list mailing list