E2457 Delphi style classes must be caught by reference (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

You can only catch a Delphi style object by pointer. Delphi style classes derive directly or indirectly from System::TObject.


Example:

void foo(TObject *p)
{
     try
     {
          throw(p);
     }
     catch    (TObject o)    // Error
     {
     }
     catch  (TObject *op)    // OK
     {
     }
}