lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I programmed some object classes (PIL 21 as guideline). What I could not find is how to call back from a subclass to a superclass.

The reason for my question:

class A has subclasses Aa and Ab, all having a function f: A:f(x), Aa:f(x), Ab:f(x)

both Aa and Ab have a large part of their code in common, I would like to keep the common code executed in the superclass A (as it will safeguard me from diverging adaptations to the code).
Therefore in Aa:f() and Ab:f()  the argument x is translated for each in a specific manner and should then passed upwards in the class heirarchy to A.
Thus an object Ab called should call back to A:f(x) with x the adapted value of x.
I hope I made myself clear.

 It might be impossible what I have in mind, but I will gladly be informed then.

yours sincerely
dr. Hans van der Meer