Required Reading: "How Non-Member Functions Improve Encapsulation"
Jacob Carlborg
doob at me.com
Thu Oct 26 14:52:23 UTC 2017
On 2017-10-26 08:56, who cares wrote:
> I tend to agree. When a member function can be written with only the
> public declarations (aka the "public API") it can be set as a free
> function. However during my youth i've written lots of huge
> classes...now that i don't write much anymore it's too late to apply the
> rule :/
In D, protection attributes applies to the module. So if the free
functions are defined in the same module, it's easy to accidentally
access private data.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list