I have an inheritance hierarchy three deep : an abstract base class, from which I derive another abstract class, call it the intermediate class, from which will derive possibly a large variety of derived classes.
At one point, the base class calls a
this.GenerateXml() method, implemented in the derived class, that returns nothing, but writes xml to a public property. At this point, I would like the intermediate class to do some stuff, without the base class or the derived class having to call a specific method on the intermediate class.
Is this possible in OO languages? Constructors call each other up the chain of inheritance. Can methods? Can an object call a method on its immediate descendant? The language in this case is C#
The obvious solution is to call a method, perhaps a same named method, from the derived class, using "base". This is less than ideal, because every derived class has to remember to make the call.