How define such scheleton classes

Learner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 15 08:55:01 PDT 2016


abstract class AbstractObject(S)
if (IsSomeString!S)
{
}

class OtherObject(S, bool R) : AbstractObject!S
{
     int x;
     void Foo(int a, int b)
     {
         x = a + b;
         static if (R)  // error
         {
            // more codes .....
         }
     }
}

class OtherObjects(S) : AbstractObject!S
{
     OtherObject!(S, bool) a, b;   // error

     a = new OtherObject!(S, true)();
     b = new OtherObject!(S, false)();
}



More information about the Digitalmars-d-learn mailing list