struct and class member alias

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Jun 6 13:34:19 PDT 2007


"Stuart Murray" <stuart.w.murray at fakey.nospambots.gmail.com> wrote in 
message news:f46eg2$1qce$1 at digitalmars.com...
> Thanks, that all seems to make sense. Thanks a lot for your help.
> As a last note I would suggest that the example:
>
>> > class A
>> > {
>> >    int foo(int x) { ... }
>> >    int foo(long y) { ... }
>> > }
>> >
>> > class B : A
>> > {
>> >    alias A.foo foo;
>> >    override int foo(long x) { ... }
>> > }
>
> seems a bit of a hacky way to fix the overload choosing thing, I suspect 
> most newcomers would assume that subclass member functions would overload 
> with superclass members of the same name. But such is life.

_Everyone_ does.  But "this is the way C++ does it," as if that means 
anything.  *sigh* 




More information about the Digitalmars-d-learn mailing list