Created
October 24, 2022 04:41
-
-
Save semlinker/348ee75840f0b444851e9db9d9cfd2d1 to your computer and use it in GitHub Desktop.
Facade Pattern in TypeScript
This file contains 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
class ShapeFacade { | |
private circle: Shape; | |
private rectangle: Shape; | |
private triangle: Shape; | |
constructor() { | |
this.circle = new Circle(); | |
this.rectangle = new Rectangle(); | |
this.triangle = new Triangle(); | |
} | |
public drawCircle(): void { | |
this.circle.draw(); | |
} | |
public drawRectangle(): void { | |
this.rectangle.draw(); | |
} | |
public drawTriangle(): void { | |
this.triangle.draw(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment