RAD Studio (Common)
ContentsIndex
PreviousUpNext
Creating a Method - Example

Assume that you want to insert a privately declared function named Test into a class named TTestClass.  

The new function shall have two arguments i and j, both of the integer type and it should return a boolean value.

To add such a function you should specify the following options in the Add Method dialog box:

  1. Type Test in Method name.
  2. Select the TTestClass class name in the Add to class combo box.
  3. Type I : Integer; J : Integer in the Arguments field.
  4. Check on the function option in the Method type group, then select boolean in the Return type combo box.
  5. Check ON the private option in the Visibility group.
  6. Click OK. The Class Explorer will add the following code for the function with the specified options:
    • into declaration of the TTestClass class: TTestClass = class .... private function Test(I : Integer; J : Integer): boolean; .... end;
    • into implementation section of the unit file:

    function TTestClass.Test(I  : Integer; J : Integer): boolean;
                begin
                end;    
            
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!