-
Notifications
You must be signed in to change notification settings - Fork 178
/
12-mixins.dart
48 lines (27 loc) · 899 Bytes
/
12-mixins.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
abstract class Animal { }
abstract class Mamifero extends Animal { }
abstract class Ave extends Animal { }
abstract class Pez extends Animal { }
abstract class Volador {
void volar() => print('estoy volando');
}
abstract class Caminante {
void caminar() => print('estoy caminando');
}
abstract class Nadador {
void nadar() => print('estoy nadando');
}
class Delfin extends Mamifero with Nadador{}
class Murcielago extends Mamifero with Caminante, Volador {}
class Gato extends Mamifero with Caminante {}
class Paloma extends Ave with Caminante, Volador {}
class Pato extends Ave with Caminante, Volador, Nadador {}
class Tiburon extends Pez with Nadador {}
class PezVolador extends Pez with Nadador, Volador {}
void main() {
// final flipper = new Delfin();
// flipper.nadar();
// final batman = new Murcielago();
// batman.caminar();
// batman.volar();
}