Last active
July 8, 2021 21:51
-
-
Save zoytsa/fb98b8ec40ceafe1c3d2bfc262aae144 to your computer and use it in GitHub Desktop.
skbx_hw_2_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 Hero { | |
| void say(); | |
| } | |
| mixin Fly { | |
| void canFly(int mySpeed) { | |
| print('Я могу летать со скоростью ${mySpeed} км/ч'); | |
| } | |
| } | |
| mixin Jump { | |
| void canJump() { | |
| print('Я могу прыгать'); | |
| } | |
| } | |
| class SuperMan extends Hero with Fly, Jump { | |
| int speed = 60; | |
| SuperMan(this.speed); | |
| @override | |
| say() { | |
| canFly(speed); | |
| canJump(); | |
| } | |
| } | |
| void main() { | |
| SuperMan superMan = SuperMan(250); | |
| superMan.say(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment