Why are interfaces so restrictive?
Lars Ivar Igesund
larsivar at igesund.net
Sat Mar 18 09:56:41 PST 2006
BCS wrote:
> In article <dvh9mr$2nbc$1 at digitaldaemon.com>, Jarrett Billingsley says...
>>
>>"BCS" <BCS_member at pathlink.com> wrote in message
>>news:dvfqn0$470$1 at digitaldaemon.com...
>>> No it wouldn't (if my understanding of interfaces is correct) all that
>>> it would require is the generation of the function pointer table at
>>> compile time and at run time, the joining of that pointer and a pointer
>>> to the struct.
>>
>>It might be possible, but it would involve making a "second" kind of
>>inheritance that wouldn't really fit into the current class and interface
>>inheritance method.
>
> Why do we say a class "inherits" from an interface? The only thing it
> gets is a set of mandatory function signatures and a way of passing
> them around. Wouldn't it be better to say that something "Implements" an
> interface?
Well, in Java it is called "implements", like
class Foo implements Serializable { }
but in C++, interfaces are only structs/classes without any implementations,
that is all methods like this
void foo() = 0;
and then there is no difference between normal inheritance and implementing
these interfaces.
But of course, "implements" would in general be the proper term.
More information about the Digitalmars-d
mailing list