[fpc-pascal] Abstract methods called from descendants via Inherited.

Bruce Tulloch pascal at causal.com
Sat Feb 16 07:08:53 CET 2013

This is a minor issue, just a question of design...

I understand that by design abstract methods cannot be called and that
doing so is an error.

However FPC used to allow an abstract method to be called from an
overriding descendant method without any error (and without doing
anything useful, of course). More recently it doesn't allow this.

It seems to me the earlier behaviour is more desirable because it
means one can write the overriding method in decedent classes in such
a way that this method can call inherited without knowing if it's
abstract or not. The new behaviour means that the overriding method in
all (first) decedent classes must be modified (to call the inherited
method) if the parent class with the abstract method is changed (or a
new class inserted in between) which makes the abstract method a
concrete one.

If the compiler silently ignored calls to abstract methods, when made
from an overriding method, this problem would be avoided and one could
change inherited behaviour in the parent class without affecting the
descendant classes (which usually call the inherited method at some

A simple work-around is to make the abstract method a "do nothing"
real one in the first place, but then one looses the benefits of the
abstract error raised when another (unrelated) object calls the
(unimplemented) method.

Am I misunderstanding something here? Why is it done the way it is done now?

Cheers, Bruce.

More information about the fpc-pascal mailing list