templates

Philippe Sigaud philippe.sigaud at gmail.com
Mon Apr 19 23:01:23 PDT 2010


On Mon, Apr 19, 2010 at 22:58, Steven Schveighoffer <schveiguy at yahoo.com>wrote:

>
> I'm not used to using interfaces in this way. What become the stored T
>> values when you cast the classes into IW to construct your array? I
>> suppose
>> they're lost?
>>
>
>
> Not sure what you mean...
>

What if the class has some value in it? In your code:

class WByVal(T) if (implementsW!T)
{
  this(T val) {this._t = val;}
  private T _t;
  int foo(int x)
  {
     return _t.foo(x);
  }
}

What happens to _t when I cast a WByVal to a IW?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100420/83c94af0/attachment.html>


More information about the Digitalmars-d-learn mailing list