mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
13 lines
259 B
V
13 lines
259 B
V
interface Animal { name string }
|
|
struct Dog { name string }
|
|
struct Cat { name string }
|
|
|
|
fn test_interface_match() {
|
|
a := Animal(Dog{name: 'Jet'})
|
|
match a {
|
|
Dog { assert true }
|
|
Cat { assert false }
|
|
else { assert false }
|
|
}
|
|
}
|