On Tue, Sep 29, 2009 at 4:14 PM, brian <bally.z...@gmail.com> wrote:

>
> On Tue, Sep 29, 2009 at 2:19 AM, Bert Van den Brande <cyr...@gmail.com>
> wrote:
> > Ok tnx now I understand the problem, though I still can't wrap my head
> > around the core issue.
> >
> > Is it that call_user_func_array() can never call private methods ? I
> found
> > some comments here and there on the web stating that the new Reflection
> API
> > will solve this, but nothing concrete on calling private methods ...
> >
> > As far as I can tell it can't be an OO issue, since
> TransactionsController
> > will inherit the setAction() method from Controller ... therefore calling
> > setAction() on an instance of TransactionsController should be allowed to
> > access the private method error() that is defined in the same
> > TransactionsController class.
> >
> > I love a good quiz now and then :)
>
> No, the parent cannot access private methods, although it seems
> somewhat counterintuitive. From the fine manual:
>
> -- snip --
> The visibility of a property or method can be defined by prefixing the
> declaration with the keywords public, protected or private. Class
> members declared public can be accessed everywhere. Members declared
> protected can be accessed only within the class itself and by
> inherited and parent classes. Members declared as private may only be
> accessed by the class that defines the member.
> -- snip --
>
> http://us2.php.net/manual/en/language.oop5.visibility.php
>
> >
>
Indeed you're right, programming in Smalltalk for a couple of months made my
OO skilz rusty, even though the method setAction() is inherited it is not
considered part of the TransactionsController class regarding the private
modifiers.

Thanks for the training ;)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to