Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
33
Task/Abstract-type/Wren/abstract-type.wren
Normal file
33
Task/Abstract-type/Wren/abstract-type.wren
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import "/fmt" for Fmt
|
||||
|
||||
class Beast{
|
||||
kind {}
|
||||
name {}
|
||||
cry() {}
|
||||
print() { System.print("%(name), who's a %(kind), cries: %(Fmt.q(cry())).") }
|
||||
}
|
||||
|
||||
class Dog is Beast {
|
||||
construct new(kind, name) {
|
||||
_kind = kind
|
||||
_name = name
|
||||
}
|
||||
kind { _kind }
|
||||
name { _name }
|
||||
cry() { "Woof" }
|
||||
}
|
||||
|
||||
class Cat is Beast {
|
||||
construct new(kind, name) {
|
||||
_kind = kind
|
||||
_name = name
|
||||
}
|
||||
kind { _kind }
|
||||
name { _name }
|
||||
cry() { "Meow" }
|
||||
}
|
||||
|
||||
var d = Dog.new("labrador", "Max")
|
||||
var c = Cat.new("siamese", "Sammy")
|
||||
d.print()
|
||||
c.print()
|
||||
Loading…
Add table
Add a link
Reference in a new issue