Skip to content

Instantly share code, notes, and snippets.

@gyugyu90
Created October 16, 2024 13:54
Show Gist options
  • Save gyugyu90/e7c49379566cccc7b82efb025622e8d9 to your computer and use it in GitHub Desktop.
Save gyugyu90/e7c49379566cccc7b82efb025622e8d9 to your computer and use it in GitHub Desktop.
class BluetoothHeadphone extends Headphone {
bool isPlaying = false;
void togglePlay() {
isPlaying = !isPlaying;
}
@override
void increaseVolume() {
if (volume == 10) {
print('최고 볼륨입니다!');
return;
}
volume += 0.5;
}
@override
void decreaseVolume() {
if (volume == 10) {
print('최고 볼륨입니다!');
return;
}
volume -= 0.5;
}
}
void main() {
BluetoothHeadphone bluetoothHeadphone = BluetoothHeadphone();
bluetoothHeadphone.increaseVolume();
print(bluetoothHeadphone.volume); // 5.5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment