diff --git a/16_interfaces/interfaces.v b/16_interfaces/interfaces.v new file mode 100644 index 0000000..9f931bc --- /dev/null +++ b/16_interfaces/interfaces.v @@ -0,0 +1,26 @@ +module main + +interface Foo{ + write(string) string +} + +interface Bar{ +mut: + write(string) string +} + +struct MyStruct{} + +fn (s MyStruct) write(a string) string{ + return a +} + +fn main(){ + s1 := MyStruct{} + + fn1(s1) +} + +fn fn1(s Foo){ + println(s.write('Foo')) +} \ No newline at end of file