{$MODE DELPHI} // Enable Class keyword type // Define a simple class TSimple = class private name : string; public function GetName : string; constructor Create(name : string); end; TNameFunc = Function : string of object; var simple : TSimple; nameFunc : TNameFunc; Function GetSum(a, b : Integer) : Integer; begin // Add the two numbers together, and return this value Result := a + b; end; // Create a simple object constructor TSimple.Create(name: string); begin // Save the passed string self.name := name; end; // Returns the simple name function TSimple.GetName: string; begin Result := name; end; begin Writeln('1 + 2',GetSum(1,2)); Writeln('62 + 444',GetSum(62,444)); // Create a simple object simple := TSimple.Create('Brian'); // Show the object name Writeln('Name accessed directly = ',simple.GetName); // Now refer to this method indirectly nameFunc := simple.GetName; // Show the object name Writeln('Name accessed indirectly = ',nameFunc); end.