On Thursday, 20 December 2012 at 10:22:56 UTC, Benjamin Thaut
wrote:
Am 20.12.2012 10:44, schrieb sclytrack:
I guess in the polite version you would make the call to the
derived
version here. The derived version wouldn't have to call super
or anything.
The problem I have with the inner method is performance. With
the super method you know which method to call at compile time.
The call can even be inlined. With the inner method you have to
do another vtable lookup for each inner call. If implemented it
should be possible to choose on a per method basis which kind
of overriding policy is used, in my opinion.
This argument is false.
With the current "usual" design:
Base instance = new Derived();
instance.method(); // #1
With Beta design:
Base instance = new Derived();
instance.method(); // #2
In case #1, the call to method itself is virtual while the call
to super is not, whereas in case #2 the call to method is _not_
virtual, but the call to inner is virtual. Either way you get one
virtual call. The difference is the direction of the calls.