Shouldn't private methods be virtual too?

Michel Fortin michel.fortin at michelf.com
Tue Jun 10 19:25:09 PDT 2008


On 2008-06-10 21:58:55 -0400, "Jarrett Billingsley" <kb3ctd2 at yahoo.com> said:

> I'll agree with you on "package".  "package" should be entirely a visibility
> attribute.  More or less it would function like 'protected' as long as the
> deriving class were in the same package; and 'private' if it weren't.  Sigh.

Yeah, but private and package in D don't apply only to derived classes. 
Private means that any code in the same module may access the method, 
and package means any code in the same package may access the method. 
This is to avoid adding something alike the friend C++ keyword 
(anything in the same module is always a friend). There's noting to 
make a member "class-private" in D.

By the way, protected methods can also be accessed from outside the 
class and its derivative if you're in the same module.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list