How to inheritance overwrite non virtual?

Axel Straschil axel at pizza.home.kosnet.com
Thu Sep 18 11:28:36 EDT 2003


Hi!

> The following will do:
> 
> class Derived(Base):
>     def method(self):
>         return Base.method(self) # call base class method

I tried in my chield-class:
class K2(KObject):
	def bestCaption(self):
		return "Overwritten"
	def bestCaptionlong(self):
		return KObject.bestCaptionlong(self)

The Problem ist inside of KObject.bestCaptionlong(self):
  return self.bestCaption()

The mother-class is calling the method of the child-class, not
it own method. I want the mother-method to be called like "the
chield never was existing", but I find no way.

Anny other idea?

Thank, AXEL.




More information about the Python-list mailing list