clear()

Max Samukha spambox at d-coding.com
Sat Oct 10 04:41:51 PDT 2009


On Sat, 10 Oct 2009 14:06:16 +0400, "Denis Koroskin"
<2korden at gmail.com> wrote:

>obj.clear(42);
>
>Wait, uniform function call syntax doesn't work with classes! Oh, well...
>
>clear!(C)(obj, 42);

We still need polymorphic behavior, meaning all constructors have to
be in classinfo, with meta information about parameter types, so that
an appropriate constructor can be found.

void clear(A...)(Object obj, A args)
{
  ...
  // find a matching constructor and call it
}

Object a = new B(41);
clear(a, 42); 






More information about the Digitalmars-d mailing list