package access specifier not usable within a class
Jonathan M Davis
jmdavisProg at gmx.com
Thu Sep 8 18:23:00 PDT 2011
On Friday, September 09, 2011 03:05:05 Andrej Mitrovic wrote:
> abstract class Foo
> {
> package void test();
> }
>
> class Bar : Foo
> {
> override package void test() { }
> }
>
> function test.Bar.test cannot override a non-virtual function
>
> TDPL says package can only be used at class-level (i.e. package class
> Bar : Foo), outside classes or inside a struct.
>
> I want to hide a virtual method from client code, but another free
> function in a different module but in the same package as these
> classes needs access to that method. Are there any technical reasons
> why package is not allowed for virtual methods?
Neither private nor protected functions are ever virtual at this point, though
it is likely that that will be changed to match TDPL. There are a number of
bugs on the matter. Among them are
http://d.puremagic.com/issues/show_bug.cgi?id=4542
http://d.puremagic.com/issues/show_bug.cgi?id=3581
http://d.puremagic.com/issues/show_bug.cgi?id=3258
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list