If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Monday, March 10, 2014

Ceylon: overriding equals and hash

1 comment:

  1. you could defined :
    shared class Fruit(name) {
    shared default Boolean canEqual(Fruit that) => true;
    }

    shared class ColouredFruit(String name, colour) extends Fruit(name) satisfies Coloured {
    shared actual default Boolean canEqual(Fruit that) => that is ColouredFruit;
    }

    (In ceylon, we have to declare a method 'shared' to be able to declare it 'default' and refine it ? we don't have the 'protected' java equivalent ?)

    ReplyDelete