[fpc-pascal] class abstract

Sven Barth pascaldragon at googlemail.com
Fri May 6 21:47:47 CEST 2011


On 06.05.2011 21:21, ik wrote:
> Hello,
>
> I have two questions regarding class Abstract:
>
> 1. From what version of FPC does it support ?

At least 2.4.2 supports it. It might be 2.4.0 as well (I don't know that 
for sure though).

> 2. Can I inherit from a class and the new class that I declare can be
> set as abstract ?
>
> I mean
>
> TClassA = class abstract
> ...
> end;
>
> TClassB = Class(TClassA) abstract ?
>
> If so, then what am I missing here? FPC (2.5.1) tell me that it is
> expecting ":", but "abstract" was found.

The "abstract" needs to be put after the "class" and before the parent 
class (it's strange, but the way Borland has decided things are done...):

TClassB = class abstract(TClassA)

Regards,
Sven



More information about the fpc-pascal mailing list