RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2021: Class type required (Delphi)

In certain situations the compiler requires a class type:

  • As the ancestor of a class type
  • In the on-clause of a try-except statement
  • As the first argument of a raise statement
  • As the final type of a forward declared class type

program Produce;
begin
raise 'This would work in C++, but does not in Delphi';
end.
  program Solve;
uses SysUtils;
begin
raise Exception.Create('There is a simple workaround, however');
end.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!