Last active
July 2, 2020 12:29
-
-
Save shivanchalaeologic/f29606d320e7bd51c35b1e786d9a1e0b to your computer and use it in GitHub Desktop.
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 Reptile { | |
void bite() => print('Chomp'); | |
void swim() => print('Swimming'); | |
void crawl() => print('Crawling'); | |
void hunt() { | |
print('${this.runtimeType} '); | |
swim(); | |
crawl(); | |
bite(); | |
} | |
} | |
class Alligator extends Reptile { | |
// Alligator Specific stuff... | |
} | |
class Crocodile extends Reptile { | |
// Crocodile Specific stuff... | |
} | |
main() { | |
Crocodile().hunt('Deer'); | |
Alligator().hunt('Fish'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment