Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Last active December 5, 2020 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsitallapudi/0c711eca3cdda10a482159386fc7c0af to your computer and use it in GitHub Desktop.
Save vamsitallapudi/0c711eca3cdda10a482159386fc7c0af to your computer and use it in GitHub Desktop.
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