[Issue 15897] base class method not seen w/ circular import
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue May 3 01:28:59 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15897
--- Comment #8 from Martin Nowak <code at dawg.eu> ---
My initial intuition was wrong here. A private method in the base class should
not be visible from a derived class, even in the base class' module.
Even in the base class' module we filter visibility through the derived class
for the following reasons.
- You can introduce a create method in the derived class which would not
conflict w/ the base class method, but hijack the call in your example.
- The derived class would "look" differently in different modules, depending on
all of it's base classes. So far we only make a distinction between the class'
module/package and other modules.
To make your code work you have to explicitly convert the derived class to the
base class you want to access,
// qualified base class access
cat.Animal.create();
// even better, get rid of the circular import
void foo(Animal animal)
{
animal.create();
}
--
More information about the Digitalmars-d-bugs
mailing list