[Tutor] Another Question

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 16 Jan 2001 19:46:13 -0800 (PST)


On Tue, 16 Jan 2001, XIA Xiao-Qin wrote:

> Sorry, I have so many question. Here is another one:

That's fine; it's perfectly ok to ask questions!


> class A:
>     def fun(self, *options):
>         ... # some codes here
> 
> class B(A):
>     def fun(self, *options):
>         ...# some codes here
>         ...# I need to call fun in class A here
> 
> How can the method fun in class B use its option tuple to call the fun
> method in the class A? The problem is caused because we can change the
> tuple (options).

You can call a specific class's version of a method if you do it
explicitly:

    A.fun(self, options)

will call the fun() that belongs to the A class.

Hope this helps!