v2 / vlib / v / gen / c / testdata / interface_dispatch_uses_methods_ptr.vv
20 lines · 15 sloc · 252 bytes · bc05b2d7d2982cea963d4da3d2786f85dec7382f
Raw
1interface Plugin {
2 print_msg()
3}
4
5struct MyPlugin {}
6
7fn (p MyPlugin) print_msg() {}
8
9fn create_plugin() Plugin {
10 return MyPlugin{}
11}
12
13fn use_plugin(plugin Plugin) {
14 plugin.print_msg()
15}
16
17fn main() {
18 plugin := create_plugin()
19 use_plugin(plugin)
20}
21