Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-05

class abstract

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

I have two questions regarding class Abstract:

1. From what version of FPC does it support ?
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.

Thanks,
Ido

LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Sven Barth
to ik
ik wrote 5 lines
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).

Show quoted text 13 lines
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

ik
to Sven Barth
Sven Barth wrote 31 lines
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...):

Thanks, that works :)

Show quoted text 9 lines
TClassB = class abstract(TClassA) Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Ido

Sven Barth
to ik
ik wrote 39 lines
On Fri, May 6, 2011 at 22:47, Sven Barth < > wrote: 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...): Thanks, that works :)

You're welcome.

Regards,
Sven