[fpc-pascal] Classes with abstract methods
Damien Gerard
milipili at shikami.org
Mon Jan 14 11:04:39 CET 2008
On Jan 14, 2008, at 10:53 AM, Michael Van Canneyt wrote:
>
>
> On Mon, 14 Jan 2008, Damien Gerard wrote:
>
>>
>> On Jan 14, 2008, at 10:27 AM, Michael Van Canneyt wrote:
>>
>>>
>>>
>>> On Mon, 14 Jan 2008, Damien Gerard wrote:
>>>
>>>>
>>>> With fpc you can get "myfile.pas(77,47) Warning: Constructing a
>>>> class
>>>> "xxxx"
>>>> with abstract methods"
>>>> I just would like to know why it is allowed to build classes with
>>>> abstract
>>>> methods. AFIK it is different from other compilers and it is a
>>>> bit strange
>>>> for
>>>> me.
>>>
>>> Delphi gives exactly the same warning.
>>
>> I don't remember that.
>
> D:\Temp>dcc32 unit1
> Borland Delphi Version 15.0
> Copyright (c) 1983,2002 Borland Software Corporation
> Unit1.pas(32) Warning: Constructing instance of 'TStrings'
> containing abstract method 'TStrings.Clear'
> Unit1.pas(32) Warning: Constructing instance of 'TStrings'
> containing abstract method 'TStrings.Delete'
> Unit1.pas(32) Warning: Constructing instance of 'TStrings'
> containing abstract method 'TStrings.Insert'
> Unit1.pas(32) Hint: Value assigned to 'T' never used
> Unit1.pas(36)
> 37 lines, 0.11 seconds, 475 bytes code, 8 bytes data.
>
Yes I trust you don't wory, just my mind is playing with me :)
>>
>>> It is allowed to create such instances: as long as you don't call
>>> any of the
>>> abstract methods, there will be no problem.
>>
>>
>> Is there a way to abort the compilation in this cases instead of a
>> warning ?
>
> Currently not.
Thanks
--
Damien Gerard
milipili at shikami.org
Le temps n'a pas d'importance. Seul le code est important
-- (f00ty)
More information about the fpc-pascal
mailing list