Abstract and sealed objects

[next] [prev] [prev-tail] [tail] [up]

### 5.2 Abstract and sealed objects

An object can be declared as sealed. In that case, it is not possible to declare a descendent object. The compiler will return an error if it encounters a declaration of a descendent:

Type
TMyClass = object Sealed
x : integer;
end;
TMyClass2 = object(TMyClass)
Y : Integer;
end;
begin
end.

This will result in the following error:

Error: Cannot create a descendant of the sealed class "TMyClass"

An abstract class is a class that cannot be used directly. Instead, a descendent class must always be used. However, for Delphi compatibility, the compiler ignores this directive.

[next] [prev] [prev-tail] [front] [up]