Skip to content

Instantly share code, notes, and snippets.

@semlinker
Created October 24, 2022 04:41
Show Gist options
  • Save semlinker/348ee75840f0b444851e9db9d9cfd2d1 to your computer and use it in GitHub Desktop.
Save semlinker/348ee75840f0b444851e9db9d9cfd2d1 to your computer and use it in GitHub Desktop.
Facade Pattern in TypeScript
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