Question on Interface.

SteveGuo steveguo at outlook.com
Wed Aug 7 05:38:03 PDT 2013


> As mentioned by evilrat earlier the 'string signature' should 
> probably be made a readonly property, set in the constructor. I 
> don't think D supports defining a constructor signature on 
> interfaces (I could be wrong), so you want to define an 
> invariant as part of the contract.
>
>
> You may also want to protect the constructor and implement a 
> factory method (or equivalent) pattern.
> I will need to look it up, but if I recall it may be possible 
> to define a 'final' function on the interface that can set the 
> 'signature'.
>
> I regret that I cannot at this time give you a definitive 
> answer as I'm not in my office where I could verify.

Thanks for the help:) I'm a newbie in D scene, so there should be 
much more to learn.



More information about the Digitalmars-d mailing list