This file contains hidden or 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
case class Food(ingredients: Seq[String]) | |
class Chef[Pizza <: Chef.Pizza] protected (ingredients: Seq[String]) { | |
import Chef.Pizza._ | |
def addCheese(cheeseType: String): Chef[Pizza with Cheese] = Chef(ingredients :+ cheeseType) | |
def addTopping(toppingType: String): Chef[Pizza with Topping] = Chef(ingredients :+ toppingType) | |
def addDough: Chef[Pizza with Dough] = Chef(ingredients :+ "dough") |