forked from smartherd/DartTutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path26_interface.dart
More file actions
46 lines (33 loc) · 738 Bytes
/
26_interface.dart
File metadata and controls
46 lines (33 loc) · 738 Bytes
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
45
46
// Objectives
// 1. Interface
void main() {
var tv = Television();
tv.volumeUp();
tv.volumeDown();
}
class Remote {
void volumeUp() {
print("______Volume Up from Remote_______");
}
void volumeDown() {
print("______Volume Down from Remote_______");
}
}
class AnotherClass {
void justAnotherMethod(){
// Code
}
}
// Here Remote and AnotherClass acts as Interface
class Television implements Remote, AnotherClass {
void volumeUp() {
// super.volumeUp(); // Not allowed to call super while implementing a class as Interface
print("______Volume Up in Television_______");
}
void volumeDown() {
print("______Volume Down in Television_______");
}
void justAnotherMethod() {
print("Some code");
}
}