Hacker News new | past | comments | ask | show | jobs | submit login

OO does not have to use classes and inheritance. OO is about encapsulation of data and behaviors. Declaring a function on a type lets you specify the behaviors of the type. In particular, in languages like Go with interfaces, it allows you to have a contract of behaviors independent of implementations. You cannot do that with plain functions.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: