Need encouraging...
James Dennett
jdennett at acm.org
Thu Oct 4 23:43:26 PDT 2007
Steven Schveighoffer wrote:
> "Arlen Albert Keshabyan" wrote
>> Steven Schveighoffer Wrote:
>>
>>> Do the listener types have any implementation? If not, you can code them
>>> as
>>> interfaces, and you don't need multiple inheritance. The JUCE project
>>> may
>>> have used multiple inheritance to emulate interfaces because interfaces
>>> are
>>> not available with C++.
>>>
>>>
>> That's not true! C++ has interfaces! Even more, abstract C++ classes can
>> be used as interfaces, as abstract classes itself and as interfaces with
>> partially implemented factions and data.
>
> No, C++ does not have interfaces.
No, C++ does have interfaces.
> It has abstract classes.
Which subsume the notion of interfaces; an interface is a
special case of a C++ abstract class, needing no additional
or special language support.
> Interfaces are
> not allowed to have implementations.
Or, to put it another way, a pure abstract base class is
also known as an "interface". An abstract base class with
implementation details is not a pure abstract base class,
i.e., not an interface.
> C++ can *mimic* interfaces with
> abstract classes that have no implementation, but the concept of an
> interface is not a language feature.
It's not mere mimicry, it's an realization of the abstract
notion of an OO "interface".
> What I meant by my comment is that
> perhaps JUCE used abstract classes/multiple inheritance to mimic interfaces
> because interfaces are not supported, but I see from your comment below that
> they have some implementation.
You might have met less resistance if you'd just said that JUCE
might use MI only for interfaces, and while D doesn't support MI
in general, it has specific facilities for this special case
(which provides some of the good features of MI, while avoiding
many of the complexities).
-- James
More information about the Digitalmars-d
mailing list