Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Positive operator overload

Project: Fractions

Unit: DelphiDabbler.Lib.Fractions

Record: TFraction

Applies to: ~>0.1

class operator Positive(const F: TFraction): TFraction;

Description

This operator overload enables the unary positive (plus) operator + to be applied to a TFraction.

The operator is a no-op. It returns an exact copy of the fraction.

Example

var
  F, FPos: TFraction;
begin
  F := TFraction.Create(3, 4);
  FPos := +F;
  Assert(
    (FPos.Numerator = F.Numerator)
    and (FPos.Denominator = F.Denominator));
end;

See Also