Created
March 27, 2020 21:50
-
-
Save nunomazer/b6287726ecf495662aa23b11af25c2d2 to your computer and use it in GitHub Desktop.
Exemplo Dart herança
This file contains hidden or 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
class Television { | |
void _illuminateDisplay() { | |
print ("Display ON"); | |
} | |
void _activateIrSensor() { | |
print ("IR sensor ON"); | |
} | |
void turnOn() { | |
_illuminateDisplay(); | |
_activateIrSensor(); | |
} | |
} | |
class SmartTelevision extends Television { | |
void _bootNetworkInterface() { | |
print ("Network booted"); | |
} | |
void _initializeMemory() { | |
print ("Reading memory"); | |
print ("X memory ready"); | |
} | |
void _upgradeApps() { | |
print ("Checking Apps new versions"); | |
} | |
void turnOn() { | |
super.turnOn(); | |
_bootNetworkInterface(); | |
_initializeMemory(); | |
_upgradeApps(); | |
} | |
} | |
void main () { | |
Television t = new Television(); | |
print("Turning on Television"); | |
t.turnOn(); | |
print(""); | |
print("Turning on SmartTv"); | |
SmartTelevision s = new SmartTelevision(); | |
s.turnOn(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment