Do non-member functions improve encapsulation in D?

Gary Willoughby via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 20 05:51:46 PDT 2014


On Sunday, 20 April 2014 at 11:12:42 UTC, Lars T. Kyllingstad 
wrote:
>> Writing classes like this allows for better encapsulation 
>> because only the required behaviour is contained within the 
>> class keeping it focused. [...]
>
> I'm also pretty sure Walter has repeatedly stated that the 
> module is the unit of encapsulation in D, not the class.

That may be true but doesn't detract anything from the quote and 
doesn't mean that classes shouldn't be well designed with good 
encapsulation in mind.


More information about the Digitalmars-d mailing list