type
TCalc = class
public
LastSum: Integer;
function GetSum(N1, N2: Integer): Integer;
end;
function TCalc.GetSum(N1, N2: Integer): Integer;
begin
LastSum := N1 + N2;
Result := LastSum;
end;
var
Calc: TCalc;
Sum1, Sum2: Integer;
begin
Calc := TCalc.Create;
Sum1 := Calc.GetSum(5, 3);
//sum1 is 8
Sum2 := Calc.GetSum(2, 3);
//sum2 is 5
WriteLn('sum1 = ', Sum1);
WriteLn('sum2 = ', Sum2);
WriteLn('calc.LastSum = ', Calc.LastSum);
end.