inblog logo
|
vosw1
    Dart

    Mixin

    송민경's avatar
    송민경
    Apr 05, 2024
    Mixin

    Mixin

    • 컴퍼지션 할 필요가 없음
    • new 가능함
    • has의 관계를 가질 수 있음 → with = has
    mixin class Engine { int power = 1000; } class Car with Engine {} void main() { Car c = Car(); print(c.power); }
    notion image
    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); }
    notion image
    Share article

    vosw1

    RSS·Powered by Inblog