Is it possible to "overload" based on visibility?
aliak
something at something.com
Wed Sep 23 19:26:43 UTC 2020
On Wednesday, 23 September 2020 at 18:38:53 UTC, 60rntogo wrote:
> There are really two questions here, one that I intended to ask
> and one that came out while I was trying to figure out the
> answer. Consider this simple code:
>
> [...]
Yeah, you can make a property setter:
private void x(int newValue) { _x = newValue }
> 2. Is the behavior that allows me to call the private method
> intended? This is such a blatant violation of encapsulation
> that it feels like a bug either in the language or the
> implementation.
Definitely sounds like a bug! Feels like this has got to be a
regression because I just tried this:
struct Foo {
private void f() {}
void f(int i) {}
}
And Foo.f() is callable from outside the module:
https://run.dlang.io/is/FVyw7u
More information about the Digitalmars-d-learn
mailing list