/*
     this(int a, int b) {
         this.a = a;
         this.b = b;
     }
*/

     void check() const pure nothrow {
         immutable real p = a ^^ 2 + b ^^ 2;
         assert(sqrt(p) < 10);
     }
}

If you keep the constructor, then it's probably better to replace check() with an invariant().

Bye,
bearophile

Reply via email to