Created
April 27, 2021 17:23
-
-
Save viniciussanchez/7f205bb66c1978ad0fdf6af8ab04bc41 to your computer and use it in GitHub Desktop.
Violação do ISP (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.ISP.Violacao; | |
interface | |
type | |
IAves = interface | |
['{1F0490B4-0D6D-4BDE-A28A-8E1E2E717874}'] | |
procedure BeberAgua; | |
procedure EmitirSom; | |
procedure Voar; | |
end; | |
TArara = class(TInterfacedObject, IAves) | |
private | |
procedure BeberAgua; | |
procedure EmitirSom; | |
procedure Voar; | |
end; | |
TPinguim = class(TInterfacedObject, IAves) | |
private | |
procedure BeberAgua; | |
procedure EmitirSom; | |
procedure Voar; | |
end; | |
implementation | |
uses System.SysUtils; | |
{ TArara } | |
procedure TArara.BeberAgua; | |
begin | |
// beber água | |
end; | |
procedure TArara.EmitirSom; | |
begin | |
// emitir som | |
end; | |
procedure TArara.Voar; | |
begin | |
// voar | |
end; | |
{ TPinguim } | |
procedure TPinguim.BeberAgua; | |
begin | |
// beber água | |
end; | |
procedure TPinguim.EmitirSom; | |
begin | |
// emitir som | |
end; | |
procedure TPinguim.Voar; | |
begin | |
raise Exception.Create('Pinguim não sabe voar!'); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment