4 ms·
Access to data members violates encapsulation. This is OOP 101. Complaining that a language doesn't allow declaration of data members in an interface declaratio
by beat 9y ago
Access to data members violates encapsulation. This is OOP 101. Complaining that a language doesn't allow declaration of data members in an interface declaration (and thus reliable direct access to data members) is basically complaining that the language enforces best practices for a 40 year old programming paradigm.
- parenthephobia 9y agoGo permits struct fields to be public. Ergo, Go doesn't care about enforcing the notion that field access violates encapsulation. It is up to the programmer to decide what is being encapsulated.