digitalmars.D.learn - visibility deprecation with last dmd compiler
- jacob (24/24) May 03 2017 I have 2 files
- Adam D. Ruppe (5/6) May 03 2017 You don't, the whole point of private is that they aren't used
I have 2 files
file abc.d:
==
module my.abc;
class Abc
{
private int x;
this() { this.x = 1; }
}
==
and xyz.d:
==
module my.xyz;
import my.abc;
class Xyz: Abc
{
this() { super(); this.x = 2; }
}
==
Compilation fails with "Deprecation: my.abc.Abc.x is not visible
from module xyz"
As I understand, the reason is
https://dlang.org/changelog/2.071.0.html#dip22
But how can I use private fields from descedant class?
May 03 2017
On Wednesday, 3 May 2017 at 14:14:16 UTC, jacob wrote:But how can I use private fields from descedant class?You don't, the whole point of private is that they aren't used from outside the module. Try `protected` instead, it is similar to private, but still allows use from a subclass.
May 03 2017








Adam D. Ruppe <destructionator gmail.com>