Created with <3 with dartpad.dev.
Last active
July 12, 2023 11:14
-
-
Save kmkkkp/f052e7ce56f0375ebaef5a8e9fcfed13 to your computer and use it in GitHub Desktop.
CascadeNotation&Abstract
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
abstract class Human{ | |
void walk(); | |
} | |
class Player extends Human{ | |
String name; | |
int xp; | |
String team; | |
void walk(){ | |
print("walking"); | |
} | |
Player({ | |
required this.name, | |
required this.xp, | |
required this.team, | |
}); | |
void sayHello() { | |
print("Hi my name is $name"); | |
} | |
} | |
class Coach extends Human{ | |
void walk(){ | |
print('the coach is wakling'); | |
} | |
} | |
void main() { | |
var nico = Player(name: 'nico', xp: 200, team:'red') | |
..name = 'las' | |
..xp = 1200000 | |
..team ='blue' | |
..sayHello(); | |
var potato = nico | |
..name = 'dos' | |
..sayHello(); | |
potato.sayHello(); | |
nico.sayHello(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment