File interface created
This commit is contained in:
parent
7a5d384d66
commit
b800b3c07b
|
|
@ -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'))
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue