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

Adam D. Ruppe destructionator at gmail.com
Fri Nov 2 00:54:43 UTC 2018


On Thursday, 1 November 2018 at 23:23:55 UTC, unprotected-entity 
wrote:
> It's about clean architecture.

If you use interfaces correctly, there will be no private members 
accessible regardless of privacy and D's module system.

interface I {}
class B : I {}

void workWithIt(I i) {
     // nothing in B is accessible without ugly casts!
}


More information about the Digitalmars-d mailing list