1
Answer

Dart default class for an interface

Sharad Gupta

Sharad Gupta

12y
1.1k
1
Dart introduce default class for an interface like-
//---------------------------

interface Dartinterface default BasicInterface{

  MyInterface();

  Dartinterface();

}

class BasicInterface implements Dartinterface{

  MyInterface(){

    print("I an a inteface");

  }

}

void main(){

  //BasicInterface obj = new BasicInterface();

  Dartinterface obj = new Dartinterface();

  obj.MyInterface();
}

-----------------------------------------------//

but i can not understood what is the main advantage of that default class interface.


Answers (1)