Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
gen
/
c
/
testdata
/
interface_dispatch_uses_methods_ptr.vv
20
lines
·
15
sloc
·
252 bytes
·
bc05b2d7d2982cea963d4da3d2786f85dec7382f
Raw
1
interface Plugin {
2
print_msg()
3
}
4
5
struct MyPlugin {}
6
7
fn (p MyPlugin) print_msg() {}
8
9
fn create_plugin() Plugin {
10
return MyPlugin{}
11
}
12
13
fn use_plugin(plugin Plugin) {
14
plugin.print_msg()
15
}
16
17
fn main() {
18
plugin := create_plugin()
19
use_plugin(plugin)
20
}
21