Last active
December 5, 2020 12:35
-
-
Save vamsitallapudi/0c711eca3cdda10a482159386fc7c0af 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 | |
fun boil() : String | |
fun freeze(): String | |
} | |
class IceCream : Food { | |
override fun name(): String { | |
return "Vanilla" | |
} | |
override fun type(): TYPE { | |
return TYPE.DESSERT | |
} | |
override fun boil(): String { | |
// not required to call boil on foods of type Dessert. This method is additionally declared. That's the | |
// violation of Interface segregation principle. | |
TODO("not implemented") | |
} | |
override fun freeze(): String { | |
return "Freezing" | |
} | |
} | |
class Noodles : Food { | |
override fun name(): String { | |
return "Schezwan Chicken Noodles" | |
} | |
override fun type(): TYPE { | |
return TYPE.FAST_FOOD | |
} | |
override fun boil(): String { | |
return "Boiling" | |
} | |
override fun freeze(): String { | |
// not required to call boil on foods of type fast food. This method is additionally declared. That's the | |
// violation of Interface segregation principle. | |
TODO("not implemented") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment