virtual, package, private

Paulo Pinto pjmlp at progtools.org
Tue Jun 18 04:41:49 PDT 2013


On Tuesday, 18 June 2013 at 09:48:13 UTC, Robert wrote:
> On Tue, 2013-06-18 at 10:34 +0200, Paulo Pinto wrote:
>> If a method is supposed to be overridable by others but not 
>> visible outside of the class that is what protected is for.
>
> It is like protected, but restricts it to classes in the 
> current module.
> This is useful at times, if you have a well known hierarchy 
> that should
> not be extended by third parties.
>
> Whether this is good design or not, is debatable, I had some 
> use cases
> where it made sense for me. Regardless, I don't see why the 
> language
> should disallow it, except for performance reasons because 
> virtual is
> the default. If this default is changed, I really see no 
> reasons to
> disallow it.

But then it overlaps partially with package, right?

Oh, well need to have a look at the right meanings. This is what 
happens when I don't use the language that much.

Sorry about the confusion,
Paulo


More information about the Digitalmars-d mailing list