forked from smartherd/DartTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"); | ||
} | ||
} |