6.2 Abstract and sealed classes

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

{$mode objfpc}  
{$h+}  
 
Type  
  TMyClass = Class Sealed  
    x : integer;  
  end;  
 
  TMyClass2 = Class(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 instantiated directly. Instead, a descendent class must always be instantiated. However, for Delphi compatibility, the compiler ignores this directive.