Golang Methods, Interfaces, & Composition

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

The compiler seems to be doing heavy lifting under the covers. It's like a reverse interface, seeing what conforms to it, rater that enforcing methods.

ashtwenty
Автор

... i cant uderstand how does it works... how does saySomething(sa1) function know to call sa method? Just because passing in secretAgent? Those abstract "say, jump, kill, teach" examples makes me crazy. It would much more clear for me if real world examples would be used. Like "Add person, Delete person, Print person, Edit person". Something meaningfull. I didnt got why in this example i need a interface. Whats the benefit? I understand what every part is and what it does. But have no idea how to apply this code for example to create new user record.

Oswee
Автор

i did understand the interface situation but its tricky by default

jpkontreras
join shbcf.ru