Skip to content

Instantly share code, notes, and snippets.

@shivanchalaeologic
Last active July 2, 2020 12:29
Show Gist options
  • Save shivanchalaeologic/f29606d320e7bd51c35b1e786d9a1e0b to your computer and use it in GitHub Desktop.
Save shivanchalaeologic/f29606d320e7bd51c35b1e786d9a1e0b to your computer and use it in GitHub Desktop.
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