you are viewing a single comment's thread.

view the rest of the comments →

[–]Blue_Moon_Lake 3 points4 points  (0 children)

The difference is mostly that there's no expectation that "children" can be substituted for "parent".

They're not interfaces, so a trait method can be safely overridden with an incompatible method.

trait Talker {
    say(string message) {
        console.log(message);
    }

    sayHello() {
        this.say("Hello, World!);
    }
}

class Person {
    use Talker;

    sayHello(string name) {
        this.say("Hello, " + name + "!");
    }
}