[Issue 17298] Wrong deprecation warnings about derived class accessing private method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 18 09:01:49 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=17298

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
This bug report is not valid. In D, the encapsulation unit is the module.
Therefore, since Derived is defined in a different module than Base, the
private method cannot be accessed through it. If you want derived to have
access to `func` just define it in the same module as `Base`.

Otherwise, you can just access `func` through Base: `new T().Base.func()`.

--


More information about the Digitalmars-d-bugs mailing list