[Tutor] [Q] inheriting a class

Young-Jin Lee ylee12@uiuc.edu
Mon, 21 Jan 2002 11:55:19 -0600


Hi, I have a question how to inherit a class.
I wanted to add a new method to the existing class and I thought it would be
possible with the following code.

####
class ball( sphere ):
    def printProperty():
        print 'print property'

####

I wanted to use the parent class's __init__ method, but when I tried typed
the above codes in the pythons shell, I got "TypeError: __init__() takes
exactly 2 arguments (4 given)" error message.
I don't know how the parent class's __init__ method is configured because it
was given as a DLL. Is there any way to use the parent class's __init__
method? How come I gave 4 arguments?

Thanks in advance.

YJ