4 ms·
Not sure I get it. Can you post some source code as an example?
by MrBuddyCasino 3y ago
Not sure I get it. Can you post some source code as an example?
- benhoyt 3y agoHere's one possibility. With an interface: https://go.dev/play/p/WTo2k_7PeRT https://go.dev/play/p/WTo2k_7PeRT type Barker interface { Name() string Bark() } And with a function-struct: https://go.dev/play/p/A_p40q1ARyR https://go.dev/play/p/A_p40q1ARyR type Barker struct { Name func() string Bark func() }