Question on Interface.
evilrat
evilrat666 at gmail.com
Wed Aug 7 00:41:17 PDT 2013
On Wednesday, 7 August 2013 at 07:30:52 UTC, SteveGuo wrote:
>> if D would allow this - what is then the difference between a
>> class with your methods as virtuals + your string?
>>
>> interface are for loosier coupling then classes - thats why
>> only declerations not implementations (like your string) are
>> allowed, same goes to Java and C# (and i think most other
>> interface having languages)
>
> But classes cannot enforce its successor to do something. May
> introduce a new keyword "enforce"?
what? O_o
let me explain, abstract class requires its successors to
implement all methods, but may have fields.
class successors *always* do something, either their methods has
derived behavior or overridden ones. so does interface, if you
has class derived from interface then its successors may or may
not override its methods.
More information about the Digitalmars-d
mailing list