scitools.com

← Metric catalog

Strict Private Methods is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.

Strict Private Methods

API ID: CountDeclMethodStrictPrivate
Languages: Pascal
Targets: Architectures, Classes, Project

Number of local strict private methods.

Object Pascal's strict private is narrower than plain private: a plain private member is visible to any code in the same unit (file), while a strict private member is only visible within the declaring class itself.

For example:


unit sample;

interface

type
  TShape = class(TPersistent)
  strict private
    FArea: Double;
    procedure CalcArea;
  strict protected
    procedure Resize;
  published
    procedure NotifyChanged;
  public
    property Area: Double read FArea write FArea;
  end;

implementation

procedure TShape.CalcArea;
begin
  FArea := 0;
end;

procedure TShape.Resize;
begin
end;

procedure TShape.NotifyChanged;
begin
end;

end.

CalcArea is declared strict private, giving CountDeclMethodStrictPrivate = 1.

See Private Methods for the plain (non-strict) access level, Strict Protected Methods for the other strict access level, and Published Methods for Object Pascal's public-with-RTTI level.

Targets By Language: Configuration: