blob: 9b48de718a8250cc839daab732950d54149f974b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
discard """
output: '''wohoo
baz'''
"""
# Test to ensure the popular 'ref T' syntax works everywhere
type
Foo = object
a, b: int
s: string
FooBar = object of RootObj
n, m: string
Baz = object of FooBar
proc invoke(a: ref Baz) =
echo "baz"
# check object construction:
let x = (ref Foo)(a: 0, b: 45, s: "wohoo")
echo x.s
var y: ref FooBar = (ref Baz)(n: "n", m: "m")
invoke((ref Baz)(y))
|