Inheritance of purity
Jason House
jason.james.house at gmail.com
Thu Feb 23 15:06:19 PST 2012
On Thursday, 23 February 2012 at 17:10:58 UTC, Bruno Medeiros
wrote:
> Sounds like a good idea.
> I would even add to this that it might be useful to have
> similar syntax that would allow to define an override method
> without having to specify the return type nor the parameters of
> the overridden method. Sometimes in class hierarchies there is
> a lot of redundancy when overriding methods and it could be a
> nice small feature to reduce that (especially for methods with
> lots of parameters).
>
> class Foo {
> int num;
>
> override opEquals {
> if(cast(Foo) o is null)
> return false;
> return this.num == (cast(Foo) o).num;
> }
>
> override toString {
> return to!(string)(num);
> }
>
> }
I don't like omitting argument names, but removing argument types
seems nice.
More information about the Digitalmars-d
mailing list