Created
April 15, 2021 11:15
-
-
Save viniciussanchez/e6990b389f6014a1e02d9f2c8dc43948 to your computer and use it in GitHub Desktop.
Violação do OCP (SOLD)
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
unit Solid.OCP.Violacao; | |
interface | |
type | |
TBancoItau = class | |
public | |
procedure GerarBoleto; | |
end; | |
TBancoCaixa = class | |
public | |
procedure GerarBoleto; | |
end; | |
TBoleto = class | |
public | |
procedure Gerar(const ABanco: TObject); | |
end; | |
implementation | |
procedure TBoleto.Gerar(const ABanco: TObject); | |
begin | |
if not Assigned(ABanco) then | |
Exit; | |
if ABanco.InheritsFrom(TBancoItau) then | |
TBancoItau(ABanco).GerarBoleto | |
else if ABanco.InheritsFrom(TBancoCaixa) then | |
TBancoCaixa(ABanco).GerarBoleto; | |
end; | |
procedure TBancoItau.GerarBoleto; | |
begin | |
end; | |
procedure TBancoCaixa.GerarBoleto; | |
begin | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment