RAD Studio (Common)
ContentsIndex
PreviousUpNext
H2440: Inline method visibility is not lower or same visibility of accessing member '%s.%s' (Delphi)

A member that is accessed within the body of an inline method must be accessible anywhere that the inline method is called. Therefore, the member must be at least as visible as the inline method. 

Here is an example of code that will raise this error:

type
   TFoo = class
   private
     PrivateMember: Integer;
   public
     function PublicFunc:Integer; inline;
   end;

function TFoo.PublicFunc:Integer; 
    begin 
        Result := Self.PrivateMember;
    end;

Because Result := Self.PrivateMember; will be inserted wherever PublicFunc is called, PrivateMember must be accessible in any such location. 

To correct this error, remove the inline directive or adjust the visibility of the inline method or the member it accesses.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!