Why do private member variables behaved like protected in the same module when creating deriving class?
Neia Neutuladh
neia at ikeran.org
Tue Oct 30 15:19:45 UTC 2018
On Tue, 30 Oct 2018 06:49:38 +0000, unprotected-entity wrote:
> Why doesn't D treat const, within a module, the same way it treats
> private?
>
> I'm mean, either we're all friends, or we're not - which is it?
>
> -------------
> class Plane {
> // private const int MAX_SPEED = 1000;
> //
> // bummer, my friends below can't change MAX_SPEED - it's
> const.
const prevents *anything* from altering the value through that variable.
const-correctness is orthogonal to encapsulation.
More information about the Digitalmars-d
mailing list