Created
April 5, 2021 14:25
-
-
Save gatherKnowledge/5c457c771071e9cc9f197b959ef5d927 to your computer and use it in GitHub Desktop.
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 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