Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The question doesn't make much sense. Your C example totally breaks encapsulation.


Well, what kind of problem is that in C? It's C. It has no public/private keywords. Nobody expect struct in C to be well-encapsulated.


It's also not a problem in C++ if you don't care. Just because C++ gives you the means to enforce encapsulation doesn't mean you have to. And, as I said below, when your goal is performance and you need to break abstractions, it makes sense not to enforce encapsulation.




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

Search: