39 lines
455 B
Plaintext
39 lines
455 B
Plaintext
extern func puts(fmt: cstring)
|
|
|
|
interface Printable
|
|
{
|
|
func print()
|
|
}
|
|
|
|
interface Stringable
|
|
{
|
|
func str(): cstring
|
|
}
|
|
|
|
struct Human : Printable, Stringable
|
|
{
|
|
name: cstring
|
|
|
|
func str(): cstring
|
|
{
|
|
return this.name
|
|
}
|
|
|
|
func print()
|
|
{
|
|
puts(this.str())
|
|
}
|
|
}
|
|
|
|
func main(args: []cstring): i64
|
|
{
|
|
let human = alloc Human {
|
|
name = "oliver"
|
|
}
|
|
|
|
puts(human.str())
|
|
// human.print()
|
|
|
|
return 0
|
|
}
|