Created
June 4, 2021 18:32
-
-
Save viniciussanchez/a5d64fe7c5b52c4d504ee284416f3ddc to your computer and use it in GitHub Desktop.
Class Operator Equal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
TVenda = record | |
Valor: Currency; | |
QuantidadeItensVendidos: Integer; | |
class operator Equal(AVenda1, AVenda2: TVenda): Boolean; | |
end; | |
var | |
LVenda1, LVenda2: TVenda; | |
begin | |
LVenda1.Valor := 100; | |
LVenda1.QuantidadeItensVendidos := 10; | |
LVenda2.Valor := 100; | |
LVenda2.QuantidadeItensVendidos := 10; | |
if LVenda1 = LVenda2 then | |
ShowMessage('Igual') | |
else | |
ShowMessage('Diferente'); | |
end; | |
{ TVenda } | |
class operator TVenda.Equal(AVenda1, AVenda2: TVenda): Boolean; | |
begin | |
Result := (AVenda1.Valor = AVenda2.Valor) and (AVenda1.QuantidadeItensVendidos = AVenda2.QuantidadeItensVendidos); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment