mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Changing static function to class function to allow method overriding
This commit is contained in:
parent
576ecc136d
commit
e9541d42b8
@ -11,9 +11,9 @@ protocol CustomisedItemFactoryCreator {
|
||||
static func getCustomisedItem(item: Item) -> CustomisedItem
|
||||
}
|
||||
|
||||
struct CustomisedItemFactory: CustomisedItemFactoryCreator {
|
||||
class CustomisedItemFactory: CustomisedItemFactoryCreator {
|
||||
// Returns the Customised Item based on the Item name
|
||||
static func getCustomisedItem(item: Item) -> CustomisedItem {
|
||||
class func getCustomisedItem(item: Item) -> CustomisedItem {
|
||||
switch item.name {
|
||||
case ItemNameConstants.kAgedBrieItem:
|
||||
return AgedBrieItem(item: item)
|
||||
@ -26,3 +26,4 @@ struct CustomisedItemFactory: CustomisedItemFactoryCreator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
struct StandardItem: CustomisedItem, ItemStateUpdater {
|
||||
class StandardItem: CustomisedItem, ItemStateUpdater {
|
||||
var item: Item
|
||||
|
||||
private var isSellInDatePassed: Bool{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user