|  |  Login Products  Sales  Support  Downloads  About | 
| Home » Technical Support » Elevate Web Builder Technical Support » Product Manuals » Elevate Web Builder 3 Manual » Language Reference » Scope | 
 Scope
 Scopeunit Unit1; interface // Public to this unit and all referencing units implementation // Private to this unit end.
// Parameters are private to the function function MyFunction(const MyParameter: String): String; var MyVariable: String; // Variables are private to the function begin end;
 In order to specifically reference the current instance of a class from within a class method, use the special Self keyword.
 In order to specifically reference the current instance of a class from within a class method, use the special Self keyword.interface
type
   TClassA = class
      private
         FMemberVariable: String;
      protected
         procedure DoSomethingMethod;
      public
         property MemberProperty: String read FMemberVariable;
      end;
   TClassB = class(TClassA)
      public
         procedure DoSomethingElseMethod;
      end;
implementation
{ TClassA Implementation }
procedure TClassA.DoSomethingMethod;
begin
   FMemberVariable := 'Test';  // Can access this variable because it is also
                               // declared within the TClassA declaration
end;
{ TClassB Implementation }
procedure TClassB.DoSomethingElseMethod;
begin
   DoSomethingMethod;  // Can access this protected method because it is
                       // declared within the ancestor TClassA declaration
end;| Scope | Description | 
| Private | Any member variables, properties, or methods declared in this scope are only visible to the properties or methods of the same class declaration. | 
| Protected | Any member variables, properties, or methods declared in this scope are only visible to the properties or methods of the same class declaration, or any descendant class declarations. | 
| Public | Any member variables, properties, or methods declared in this scope are visible everywhere, subject to the scoping rules of the referencing declaration or code block. | 
| Published | Same as Public, but in addition, all properties declared in this scope are streamable and will appear in the IDE's component inspector. | 
interface
type
   TMyClass = class
      private
         MyVariable: String;
         procedure MyMethod;
      end;
   
implementation
procedure TMyClass.MyMethod;
var
   MyVariable: String; // This declaration overrides the scope of the class
begin
   MyVariable := 'Test';       // This will be assigned to the local
                               // MyVariable variable
   Self.MyVariable := 'Test';  // This will be assigned to the MyVariable member
                               // variable of the TMyClass class
end; More Support Options
 More Support Options| This web page was last updated on Tuesday, September 16, 2025 at 04:56 PM | Privacy Policy  Site Map © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ?  E-mail us at info@elevatesoft.com | 
