File tree Expand file tree Collapse file tree 8 files changed +12
-12
lines changed
Creational/AbstractFactory.playground/Sources Expand file tree Collapse file tree 8 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1- public struct ChairBedroom : Chair {
1+ public struct BedroomChair : Chair {
22 public var name : String = " Chair "
33 public var type : String = " Chair for bedroom "
44}
Original file line number Diff line number Diff line change @@ -7,16 +7,16 @@ public struct BedroomFactory: AbstractFactory {
77
88 public func createChair( ) -> Chair {
99 print ( " Bedroom chair created " )
10- return ChairBedroom ( )
10+ return BedroomChair ( )
1111 }
1212
1313 public func createTable( ) -> Table {
1414 print ( " Bedroom table created " )
15- return TableBedroom ( )
15+ return BedroomTable ( )
1616 }
1717
1818 public func createSofa( ) -> Sofa {
1919 print ( " Bedroom sofa created " )
20- return SofaBedroom ( )
20+ return BedroomSofa ( )
2121 }
2222}
Original file line number Diff line number Diff line change 1- public struct SofaBedroom : Sofa {
1+ public struct BedroomSofa : Sofa {
22 public var name : String = " Sofa "
33 public var type : String = " Sofa for bedroom "
44}
Original file line number Diff line number Diff line change 1- public struct TableBedroom : Table {
1+ public struct BedroomTable : Table {
22 public var name : String = " Table "
33 public var type : String = " Table for bedroom "
44}
Original file line number Diff line number Diff line change 1- public struct ChairKitchen : Chair {
1+ public struct KitchenChair : Chair {
22 public var name : String = " Chair "
33 public var type : String = " Chair for kitchen "
44}
Original file line number Diff line number Diff line change @@ -7,16 +7,16 @@ public struct KitchenFactory: AbstractFactory {
77
88 public func createChair( ) -> Chair {
99 print ( " Kitchen chair created " )
10- return ChairKitchen ( )
10+ return KitchenChair ( )
1111 }
1212
1313 public func createTable( ) -> Table {
1414 print ( " Kitchen table created " )
15- return TableKitchen ( )
15+ return KitchenTable ( )
1616 }
1717
1818 public func createSofa( ) -> Sofa {
1919 print ( " Kitchen sofa created " )
20- return SofaKitchen ( )
20+ return KitchenSofa ( )
2121 }
2222}
Original file line number Diff line number Diff line change 1- public struct SofaKitchen : Sofa {
1+ public struct KitchenSofa : Sofa {
22 public var name : String = " Sofa "
33 public var type : String = " Sofa for ktichen "
44}
Original file line number Diff line number Diff line change 1- public struct TableKitchen : Table {
1+ public struct KitchenTable : Table {
22 public var name : String = " Table "
33 public var type : String = " Table for kitchen "
44}
You can’t perform that action at this time.
0 commit comments