aliasing base methods

Frank Benoit (keinfarbton) benoit at tionex.removethispart.de
Sun Feb 25 11:51:21 PST 2007


> Another thought -- making override required could make life difficult
> for some code generators.  Imagine an automatic class wrapper that
> creates a derived class of the form:
> 
> class foo(Base)  : Base
> {
>    int someMethod(int x) { ... }
> }
> 
> That will always work now, but if override becomes required, then that
> template will have to do some static if mojo to figure out if Base
> already has a someMethod(int) implemented or not and if so stick in the
> 'override'.

No, it will not work.
Today you also need to know the base class methods, and add aliases in
you generated class, if needed. The problem is exactly the same. TioPort
actually implements this.

For generated code, it is probably easier this way with override.
Because if you generate code, you most of the time know, that you do a
override.

To the ambiguity issue of the alias:
Override is always/already precise, because it *is* bundled with the
complete method signature.



More information about the Digitalmars-d mailing list