No header files?
Walter Bright
newshound1 at digitalmars.com
Thu Oct 22 00:52:39 PDT 2009
AJ wrote:
> "Walter Bright" <newshound1 at digitalmars.com> wrote in message
> news:hbo7fa$316k$2 at digitalmars.com...
>> AJ wrote:
>>> You lose the ability to use, say a class declaration, as the
>>> specification (at least without a sophisitcated,
>>> code-folding/code-formatting IDE).
>> Just change "class" to "interface" and you're good to go.
>
> Seems "apples and oranges" to me. "class declaration" can have data members
> while "interface" can't.
It's usually considered good style to keep your data members hidden from
users. Interfaces do that nicely.
> I mean, "my concept of it". I don't know what
> definitions D has of those things. In C++, I use interfaces where
> appropriate (say, where usage outside of a given library/subsystem is
> anticipated/desired), but for most purposes (say, within a given
> library/subsystem), I want a full class declaration (with data members etc).
> When I think "interface", I think "pure abstract base class" and is
> something strictly behavioral. When thinking "class" or "struct", I think
> first of the data members, something more nominal ("noun-ish").
If you're exposing data members to all the users, then you might as well
expose the function bodies, too, because the benefits of hiding the
implementation are already mostly gone.
More information about the Digitalmars-d
mailing list