
Mixin
- 컴퍼지션 할 필요가 없음
- new 가능함
- has의 관계를 가질 수 있음 → with = has
mixin class Engine { int power = 1000; } class Car with Engine {} void main() { Car c = Car(); print(c.power); }

mixin class Wheel { String name = "바퀴"; } mixin class Engine { int power = 1000; } class Car with Engine, Wheel {} void main() { Car c = Car(); print(c.power); print(c.name); }

Share article