Day5

Day5

Interface.kt
// Interface // all function and variable inside interface will be abstract // and you cant change it interface Myinterface { fun myfun() } interface Myinterface1 { fun myfun12() } // can implement more than one interface in one class // use " : " to implement interface // use " , " between inteface to add more than one interface class Mymaibxlass : Myinterface, Myinterface1 { override fun myfun() { } override fun myfun12() { } }
 
abstractClass.kt
// Abstarct Class is Bydefault open // You can't access Abstarct Class or its functions directly // To use Abstarct Class it must be extend in another class abstract class Myclass1 { abstract fun Myfunction() open fun mm() { } } abstract class Myclass2 { abstract fun Myfunction2() open fun mm2() { } } // you can't extend more than one abstract class in another class // extended class should be followed by parenthese " ( ) " class Mysecondclass : Myclass() { override fun Myfunction() { } override fun mm() { } }