How about:
type
MyImplementationA = object
MyImplementationB = object
m_foo,m_bar: int
proc foo(this: MyImplementationA): int =
return 17
proc bar(this: MyImplementationA): int =
return 4
proc foo(this: MyImplementationB): int =
return this.m_foo
proc bar(this: MyImplementationB): int =
return this.m_bar
proc foobar[T](mi: T): int =
return mi.foo() + mi.bar()
var a = MyImplementationA()
var b = MyImplementationB(m_foo: 32, m_bar: 8)
echo foobar(a)
echo foobar(b)
- Go-lang like interface Krux02
- Re: Go-lang like interface Araq
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface bpr
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface jangko
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface Dippo
- Re: Go-lang like interface _tulayang
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface OderWat
- Re: Go-lang like interface _tulayang
- Re: Go-lang like interface _tulayang
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface _tulayang
- Re: Go-lang like interface Krux02
- Re: Go-lang like interface OderWat
- Re: Go-lang like interface _tulayang
- Re: Go-lang like interface Krux02
