Created
December 5, 2020 12:38
-
-
Save vamsitallapudi/d8d1ed12caf97ee6068215975e862d59 to your computer and use it in GitHub Desktop.
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
package main.leetcode.kotlin.solidPrinciples.InterfaceSegregation | |
enum class TYPE { | |
FAST_FOOD, DESSERT, INDIAN, CHINESE | |
} | |
interface Food { | |
fun name(): String | |
fun type(): TYPE | |
} | |
interface ColdFood: Food { | |
fun freeze() : String | |
} | |
interface HotFood: Food { | |
fun boil() : String | |
} | |
class IceCream : ColdFood { | |
override fun name(): String { | |
return "Vanilla" | |
} | |
override fun type(): TYPE { | |
return TYPE.DESSERT | |
} | |
override fun freeze(): String { | |
return "Freezing" | |
} | |
} | |
class Noodles : HotFood { | |
override fun name(): String { | |
return "Schezwan Chicken Noodles" | |
} | |
override fun type(): TYPE { | |
return TYPE.FAST_FOOD | |
} | |
override fun boil(): String { | |
return "Boiling" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment