class Player {
String name;
int xp;
String team;
Player({required this.name, required this.xp, required this.team});
void sayHello() {
print("Hi my name is $name");
}
}
vodi main() {
var nico = Player(name: 'nico', xp: 1200, team: 'red')
..name = 'las'
..xp = 12000
..team = 'blue';
}
enum Team { red, blue }
enum XPLevel { beginner, medium, pro }
void main() {
var nico = Player(name: 'nico', XPLevel.medium, Team.red)
..name = 'las'
..xp = XPLevel.pro
..team = Team.blue;
}
다른 클래스들이 직접 구현 해야하는 메소드들을 모아놓은 일종의 청사진으로,
객체를 생성할 수 없는 클래스 ;.
abstract class Human {
void walk();
}
enum Team { red, blue }
enum XPLevel { beginner, medium, pro }
class Player extends Human {
String name;
XPLevel xp;
Team team;
Player({required this.name, required this.xp, required this.team});
void walk {
print('im walk');
}
void sayHello() {
print("Hi my name is $name, XP is $xp, Team is $team");
}
}
class Coach extends Human {
void walk() {
print('the coach is walking');
}
}
void main() {
var nico = Player(name: 'nico', XPLevel.medium, Team.red)
..name = 'las'
..xp = XPLevel.pro
..team = Team.blue;
}
class Human {
final String name;
Human({required this.name});
void sayHello() {
print("Hi my name is $name");
}
}
enum Team { blue, red };
class Player extends Human {
final Team team;
Player({
required this.team,
required String name,
}) : super(name: name);
@override
void sayHello() {
super.sayHello();
print('and I play for ${team}');
}
}
void main() {
var player = Player(
team: Team.red,
);
}
class Strong {
final double strengthLvel = 1500.99;
}
class QuickRunner {
void runQuick() {
print('runnnnnnnnnnnnn!');
}
}
class Tall {
final double height = 1.99;
}
class Player with Strong, QuickRunner, Tall {
final Team team;
}
class Horse with Strong, QuickRunner {
}
class Kid with QuickRunner {
}
void main() {
var player = Player(
team: Team.red,
);
player.runQuick