virtual, package, private

Paulo Pinto pjmlp at progtools.org
Tue Jun 18 01:34:49 PDT 2013


On Tuesday, 18 June 2013 at 07:57:23 UTC, deadalnix wrote:
> On Tuesday, 18 June 2013 at 07:27:50 UTC, Namespace wrote:
>> I'm also for an explicit 'virtual' keyword.
>> But I don't get why private methods should be virtual? That 
>> makes never sense.
>
> Because the unit of encapsulation in D is the module not the 
> class.

Still it does not make sense.

If a method is supposed to be overridable by others but not 
visible outside of the class that is what protected is for.

I have experience in several OO languages and I consider C++'s 
private virtual
belongs to the same dustbin as checked exceptions, as I am yet to 
find any design scenario where it makes sense.

--
Paulo



More information about the Digitalmars-d mailing list