mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
18 lines
219 B
V
18 lines
219 B
V
struct Cat {
|
|
x int = 123
|
|
}
|
|
|
|
interface Adoptable {
|
|
}
|
|
|
|
fn test_casting_to_interface() {
|
|
cat := Cat{}
|
|
a := Adoptable(cat)
|
|
if a is Cat {
|
|
assert typeof(a).name == '&Cat'
|
|
assert a.x == 123
|
|
return
|
|
}
|
|
assert false
|
|
}
|