Larry Wall wrote:
>>>> How private is private? I wonder if what you've called private
>>>> things are really more like "protected" in C++ (accessible by the
>>>> derived class) and that 'my' attributes are really private, as are
>>>> submethods. It's all confused. Who is allowed to access what?
>>> No, private methods are not accessible from derived classes, unless
>>> the base class explicitly trusts them -- See L12/"the exclamation
>>> form may be  used only in the actual class, not in derived classes".
>>> Cheers,
>>> Audrey
> It is my understanding that even Bjarne thinks "protected" is a bad
> idea these days...
> Larry

I believe Mr. Stroustrup's deprecation of 'protected' access applies only to data data members, not function members:

  Fortunately, you don't have to use protected data in C++; 'private'
  is the default in classes and is usually the better choice.  Note
  that none of these objections are significant for protected member
  *functions*.  I still consider 'protected' a fine way of specifying
  operations for use in derived classes.

  -- Bjarne Stroustrup
     Section 13.9 [Protected Members]

So I understand Perl 6 will have no protected access for data members (though trusted access can be used to provide a similar back door).

But does Perl 6 have protected access for methods?

Reply via email to