Beginners Dart - Polymorphism Mixins
class Animal { //Start of the parent - child higherarcy
bool isAlive = true;
void breath() => print("Breathing");
}
class Cuthulu {
bool hasTentecals = true;
void whip() => print("Whccccchhhaaaa");
void attack(){
print("Eats world");
}
}
class Dragon {
bool hasScales = true;
void devour() => print("Eats subject");
void attack() {
print("Breaths fire");
}
}
class Ghost {
bool isCorporeal = false;
void dreamEater() => print("Eats Dream");
void attack() {
print("Sprays goop");
}
}
class Monster extends Dragon with Ghost, Cuthulu, Animal {
bool hasSharpTeeth = true;
void scareVillager() => print("RAAAAAAAAAAAHHHHH");
void attack() {
print("Claws at face");
}
}
void main() {
Monster bill = new Monster();
bill.attack();
bill.devour();
bill.dreamEater();
bill.whip();
bill.scareVillager();
bill.breath();
}