TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Encapsulation – Where is the perimeter of a class type?

1 pointsby SilentLambdaover 2 years ago

1 comment

SilentLambdaover 2 years ago
This D programming blog argues that C++ friend breaks encapsulation. I reject that argument, and say that C++ friend puts a door in the wall, and a guard at that door, and therefore encpasulation both remains, but is also extended (in the same way entangled particles are both encapsulated in themselves, but also in their encapsulated partner particle(s).<p>The article also argues that D&#x27;s approach to allowing all code within a D module to be within the perimeter of any class type within that module, at all times, enhances encapsulation. I propose, that such an approach can only break encapsulation of a class type, and that it cannot possibly enhance it.