Mixin
Last updated
Last updated
Mixin specifications are evolving in Dart . Keep up to date with the specification and documentation
void main() {
// Mixins
// var manager1 = Manager();
// manager1.manageproject();
// manager1.work();
var ceo1 = CEO();
ceo1.manageproject();
ceo1.work();
ceo1.recruit();
}
class Employee {
void work() {
print("Work");
}
}
class HR extends Employee {
void recruit() {
print("Recruit Employee");
}
}
class Manager extends Employee with CanManageProject {}
class CEO extends HR with CanManageProject {}
mixin CanManageProject {
void manageproject() {
print("manage project");
}
}
void main() {
// Mixins
// var manager1 = Manager();
// manager1.manageproject();
// manager1.work();
var ceo1 = CEO();
ceo1.startproject();
}
class Employee {
void work() {
print("Work");
}
}
class HR extends Employee {
void recruit() {
print("Recruit Employee");
}
void keeplog() {
print("keep log for recurit ");
}
}
class Manager extends Employee with CanManageProject {}
class CEO extends HR with ExecutiveDecision, CanManageProject {
void startproject() {
manageproject();
keeplog();
}
}
mixin CanManageProject {
void manageproject() {
print("manage project");
}
void keeplog() {
print("Log for managing project");
}
}
mixin ExecutiveDecision {
void decision() {
print("Executive Decision");
}
void keeplog() {
print("Log for Executive Decision");
}
}
void main() {
var ceo1 = CEO();
ceo1.startproject();
}
class Employee {
void work() {
print("Work");
}
}
class HR extends Employee {
void recruit() {
print("Recruit Employee");
}
void keeplog() {
print("keep log for recurit ");
}
}
class Manager extends Employee with CanManageProject {}
class CEO extends HR with ExecutiveDecision, CanManageProject {
void startproject() {
manageproject();
keeplog();
}
}
class CTO extends HR with ExecutiveDecision, CanManageProject {}
mixin CanManageProject {
void manageproject() {
print("manage project");
}
void keeplog() {
print("Log for managing project");
}
}
mixin ExecutiveDecision on HR {
void decision() {
print("Executive Decision");
}
void keeplog() {
print("Log for Executive Decision");
}
}