Why do private member variables behaved like protected in the same module when creating deriving class?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Nov 1 16:32:23 UTC 2018


On Thu, Nov 01, 2018 at 04:19:57PM +0000, 12345swordy via Digitalmars-d wrote:
> On Thursday, 1 November 2018 at 14:17:13 UTC, Atila Neves wrote:
> > On Monday, 29 October 2018 at 23:15:58 UTC, unprotected-entity wrote:
> > > On Monday, 29 October 2018 at 15:50:56 UTC, Jonathan M Davis wrote:
> > > It's not (just) that I don't like it, it's that I don't like not
> > > giving the programmer the tool to better encapsulate their code
> > > (specifically classes) *within* a module.
> > 
> > You don't need to protect code in your module from other code in
> > your module. If you do, put them in different modules.
>
> That typically involves creation of files, which is not always ideal
> if you are working with code that is considerably small.

Java also enforces, by policy, the creation of a separate file for every
public class.  This is no different.


T

-- 
Genius may have its limitations, but stupidity is not thus handicapped. -- Elbert Hubbard


More information about the Digitalmars-d mailing list