abstract class member functions can not have contracts
ref2401
refactor24 at gmail.com
Wed May 15 07:16:11 PDT 2013
Interface member functions can have in/out contracts but why
abstract class member functions can not?
abstract class Base
{
@property int field();
void foo() in { assert(field > 0); }
// Error: function main.Base.foo in and out contracts require
function body
// An empty body definition fixes this error.
}
interface IBase
{
@property int field();
void foo() in { assert(field > 0); } // OK
}
More information about the Digitalmars-d-learn
mailing list