Google News
logo
Dart - Interview Questions
Explain an interface in dart with an example?
Unlike other languages dart does not have any interface keyword, You can implement it with an abstract keyword
abstract class Joker{
  void makePeopleLaugh();
}

class Clown implements Joker{
  void makePeopleLaugh() {
    // Here is where the magic happens
  }
}

class Comedian implements Joker{
  void makePeopleLaugh() {
    // Here is where the magic happens
  }
}​
Advertisement