Created
May 26, 2022 15:52
-
-
Save aaripurna/e117f791d32fdeba8f44b41ce1dbd2bb 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
abstract class Baz | |
abstract def call(args : String) : String | |
end | |
class Bar < Baz | |
def call(args : String) : String | |
"#{args} + bar" | |
end | |
end | |
class Bur < Baz | |
def call(args : String) : String | |
"#{args} + bur" | |
end | |
end | |
class Foo | |
@foos = Array(Baz) | |
def initialize(args : Array(Baz)) | |
@foos = args | |
end | |
def add(arg : Baz) | |
@foos.append(arg) | |
end | |
end | |
foo = Foo.new([Bar.new, Bur.new]) | |
foo.add(Bar.new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment