Created
February 5, 2021 16:55
-
-
Save djberg96/fcbff4c0d0651209a932e6872121bb0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
include Comparable(self) | |
getter name : String | |
getter age : Int32 | |
def initialize(@name, @age) | |
end | |
def <=>(other : self) | |
age <=> other.age | |
end | |
end | |
class Bar < Foo | |
end | |
f1 = Foo.new("Dan", 51) | |
b1 = Bar.new("Joe", 35) | |
p f1 > b1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment