Abstract class contracts
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Feb 25 11:36:45 PST 2013
Why does D require that in-contracts on a class method must have a
method body? Based on my understanding of TDPL, in-contracts are
supposed to be inherited by derived classes, aren't they? Currently I
can't seem to convince DMD to accept an in-contract on an abstract base
class method:
abstract class Base {
abstract int method(int j)
in { assert(j < 10); }; // <-- compile error
}
What's the rationale for this? Doesn't it defeat the purpose of DbC (I
want the abstract base class to "set the rules" as to what are
acceptable parameters to methods)?
T
--
Кто везде - тот нигде.
More information about the Digitalmars-d
mailing list