struct constructors and function parameters

Simen kjaeraas simen.kjaras at gmail.com
Tue Nov 9 16:21:17 PST 2010


Adam Burton <adz21c at gmail.com> wrote:

> True, I had thought of that, but I figured in that situation it would  
> favour
> int over foo (in same way long vs int) so to access foo you'd need to
> explicitly use the constructor. On the other hand I suppose its more of a
> difficult decision when you hit something like below
>
> struct A
> {
>    this(int)
> }
> struct B
> {
>    this(int)
> }
>
> void bar(A)
> void bar(B)

Yup. That was what I'd planned to write, but then my brain took a
shortcut. :p As you say though, overloading rules mean the int version
would be chosen.


-- 
Simen


More information about the Digitalmars-d-learn mailing list