Skip to content

Instantly share code, notes, and snippets.

@gatherKnowledge
Created April 5, 2021 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatherKnowledge/5c457c771071e9cc9f197b959ef5d927 to your computer and use it in GitHub Desktop.
Save gatherKnowledge/5c457c771071e9cc9f197b959ef5d927 to your computer and use it in GitHub Desktop.
class House {
address?: string;
postCode?: string;
constructor() { }
}
class HouseBuilder {
private readonly _house: House;
constructor() {
this._house = new House();
}
setAddress(address: string) {
this._house.address = address;
return this;
}
setPostCode(postCode: string) {
this._house.postCode = postCode;
return this;
}
build() {
return this._house;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment