Created
April 15, 2021 11:20
-
-
Save viniciussanchez/1c7105d23c63ed61204010834ca7364d to your computer and use it in GitHub Desktop.
Padrão Open-Closed Principle (SOLID)
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.Boleto; | |
interface | |
type | |
IBanco = interface | |
['{71EB60CC-91C0-40E3-9D58-9F2CC46E84A9}'] | |
procedure GerarBoleto; | |
end; | |
TBancoItau = class(TInterfacedObject, IBanco) | |
private | |
procedure GerarBoleto; | |
end; | |
TBancoCaixa = class(TInterfacedObject, IBanco) | |
private | |
procedure GerarBoleto; | |
end; | |
TBoleto = class | |
public | |
procedure Gerar(const ABanco: IBanco); | |
end; | |
implementation | |
procedure TBoleto.Gerar(const ABanco: IBanco); | |
begin | |
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