Abstract classes vs interfaces, casting from void*
John Colvin
john.loughran.colvin at gmail.com
Sun Aug 11 16:05:20 UTC 2019
On Sunday, 11 August 2019 at 15:16:03 UTC, Alex wrote:
> On Sunday, 11 August 2019 at 13:09:43 UTC, John Colvin wrote:
>>> Ok. What would go wrong (in D) if I just replaced every
>>> interface with an abstract class?
>>
>> I think there's some confusion here, because B.foo is not
>> abstract. abstract on a class is not inherited by its methods.
>> https://dlang.org/spec/attribute.html#abstract
>
> Now, I'm confused, as you asked about abstract classes. So,
> yes, you can define the abstractness of classes differently.
> And what is your point?
I'm trying to narrow down exactly what patterns work with each
and how they overlap.
What I was trying to get at with the abstract method thing is that
abstract class C
{
void foo();
}
is an abstract class with a non-abstract method, whose
implementation is going to come from somewhere else (not a common
pattern in D).
class C
{
abstract void foo();
}
is an abstract class with an abstract method foo, which means you
have to override it in a inheriting class to get a non-abstract
class.
More information about the Digitalmars-d-learn
mailing list