[fpc-pascal] Classes with abstract methods

Matt Emson memsom at interalpha.co.uk
Mon Jan 14 11:13:52 CET 2008


Graeme Geldenhuys wrote:
> On 14/01/2008, Michael Van Canneyt <michael at freepascal.org> wrote:
>   
>>> Is there a way to abort the compilation in this cases instead of a warning ?
>>>       
>> Currently not.
>>     
>
> If you want to be that strict, then use Interfaces instead of Abstract classes

I always found (and still do in C#) that interfaces are good for forcing 
structure but bad for forcing good inheritance trees. The good thing 
about classes with abstract methods is that they form a point for 
inheritance. Interfaces - well, I regularly use interfaces to create a 
common structure, e.g. an API that will have both a webservice interface 
and a local interface. The common API is an interface in a separate 
assembly, used on both client and server to implement an identical API 
(client code can then link to either the local API or the webservice via 
a client that implements the same interface.) DotNet also makes 
reflection (RTTI) quite useful with interfaces too, but I digress. The 
point is that the webservice class, the client and the local API that 
the webservice wraps all implement the interface (the webservice usually 
just delegates responsibility to an internal instance), but none of them 
inherit from each other.





More information about the fpc-pascal mailing list