Skip to content

Instantly share code, notes, and snippets.

@viniciussanchez
Last active June 4, 2021 18:03
Show Gist options
  • Save viniciussanchez/d6dc142056512c7e36a7b30c726e17df to your computer and use it in GitHub Desktop.
Save viniciussanchez/d6dc142056512c7e36a7b30c726e17df to your computer and use it in GitHub Desktop.
Class Operator Add
type
TVenda = record
Valor: Currency;
class operator Add(AVenda1, AVenda2: TVenda): Currency;
end;
var
LVenda1, LVenda2: TVenda;
begin
LVenda1.Valor := 100;
LVenda2.Valor := 50;
ShowMessage(CurrToStr(LVenda1 + LVenda2));
end;
{ TVenda }
class operator TVenda.Add(AVenda1, AVenda2: TVenda): Currency;
begin
Result := AVenda1.Valor + AVenda2.Valor;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment