package access specifier not usable within a class

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Sep 8 18:05:05 PDT 2011


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?


More information about the Digitalmars-d-learn mailing list