Skip to content

Instantly share code, notes, and snippets.

@viniciussanchez
Created April 15, 2021 11:20
Show Gist options
  • Save viniciussanchez/1c7105d23c63ed61204010834ca7364d to your computer and use it in GitHub Desktop.
Save viniciussanchez/1c7105d23c63ed61204010834ca7364d to your computer and use it in GitHub Desktop.
Padrão Open-Closed Principle (SOLID)
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