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
| abstract interface class ToBeImplemented { | |
| void doSomething(); | |
| } |
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 Implementation implements MyClass { | |
| @override | |
| int _privateInstanceVariable = 0; | |
| @override | |
| int instanceVariable = 0; | |
| @override | |
| void _privateMethod() { | |
| // TODO: implement _privateMethod |
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 MyClass { | |
| static final CONSTANT = 1; | |
| static void staticMethod() { | |
| print('this is static method'); | |
| } | |
| int instanceVariable = 2; | |
| final finalInstanceVariable = 3; |
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
| abstract class Feed { | |
| void onClick(); | |
| } | |
| class PostFeed implements Feed { | |
| @override | |
| void onClick() { | |
| print('show tags'); | |
| } | |
| } |
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
| abstract class Feed { | |
| void onClick(); | |
| } | |
| class PostFeed extends Feed { | |
| @override | |
| void onClick() { | |
| print('show tags'); | |
| } | |
| } |
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
| void main() { | |
| var headphones = [ | |
| BluetoothHeadphone(), | |
| Headphone(), | |
| NoiseCancellingHeadphone() | |
| ]; | |
| headphones.forEach((headphone) { | |
| headphone.decreaseVolume(); | |
| print(headphone.volume); // 4.5, 4.0, 4.8 |
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
| void main() { | |
| Headphone bluetoothHeadphone = BluetoothHeadphone(); | |
| // bluetoothHeadphone.togglePlay(); // Error: The method 'togglePlay' isn't defined for the class 'Headphone'. | |
| bluetoothHeadphone.increaseVolume(); | |
| print(bluetoothHeadphone.volume); // 5.5 | |
| } |
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 NoiseCancellingHeadphone extends BluetoothHeadphone { | |
| bool noiseCancellingEnabled = false; | |
| @override | |
| double get volumeUnit => 0.2; | |
| void toggleNoiseCancelling() { | |
| noiseCancellingEnabled = !noiseCancellingEnabled; | |
| } |
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 Headphone { | |
| double volume = 5; | |
| double volumeUnit = 1; | |
| void increaseVolume() { | |
| if (volume == 10) { | |
| print('최고 볼륨입니다!'); | |
| return; | |
| } |
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 BluetoothHeadphone extends Headphone { | |
| bool isPlaying = false; | |
| void togglePlay() { | |
| isPlaying = !isPlaying; | |
| } | |
| @override | |
| void increaseVolume() { | |
| if (volume == 10) { |
NewerOlder