Inheritance...

K

KraftDiner

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,268
Messages
2,571,344
Members
48,019
Latest member
Migration_Expert

Latest Threads

Top