dart: Mixins

Darcy Daeseok YU ·2022년 12월 2일
0

Multiple Extends with other classes
just get other classes' property or method

class Strong {
  final double strengthLevel = 15.99;
}

class Quick {
  void dashQuickly() => print('Runnnnnnnnnnnn');
}

class Player with Strong, Quick {
  String name;

  Player({required this.name});
}

void main() {
  var player = Player(name: 'Sonnn');

  print(player.name);
  print(player.strengthLevel);
  player.dashQuickly();
}
profile
React, React-Native https://darcyu83.netlify.app/

0개의 댓글