Skip to content

Instantly share code, notes, and snippets.

@yaakov123
Created August 2, 2020 18:20
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 yaakov123/890077bcccab317ae956d40ec3e35f34 to your computer and use it in GitHub Desktop.
Save yaakov123/890077bcccab317ae956d40ec3e35f34 to your computer and use it in GitHub Desktop.
class DressClothesFactory {
constructor() {
}
getShoes() {
return new DressShoes();
}
getShirt() {
return new DressShirt();
}
}
class CasualClothesFactory {
constructor() {
}
getShoes() {
return new CasualShoes();
}
getShirt() {
return new CasualShirt();
}
}
class DressShoes {
constructor() {
}
// ...Shoe stuff here
}
class CasualShoes {
constructor() {
}
// ...Shoe stuff here
}
class DressShirt {
constructor() {
}
// ...Shirt stuff here
}
class CasualShirt {
constructor() {
}
// ...Shirt stuff here
}
const dressClothesFactory = new DressClothesFactory();
const dressShoes = dressClothesFactory.getShoes();
const casualClothesFactory = new CasualClothesFactory();
const casualShirt = casualClothesFactory.getShirt();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment