All Questions
5
questions
3
votes
1
answer
3k
views
child class accessing parent's private method?
A user posted a comment on PHP Visibility manual page. It's the second most voted comment. He used this code example:
<?php
abstract class base {
public function inherited() {
$this-&...
4
votes
3
answers
2k
views
What is the difference between the keyword 'Private' and 'Final'?
Having a confusion between Private and Final in PHP.
For example I have 3 classes:
Class A (parent class)
Class B (child class)
Class C (other class)
What I understand:
A: Public variables and ...
0
votes
2
answers
157
views
Why can you call a private method from outside of the object scope?
I am curious as to why this is allowed to work, whereby you can call and successfully execute a private method on an object from outside of the object scope providing you are making the call from a ...
1
vote
1
answer
2k
views
Changing the visibility scope of parent methods in child classes
I've got a Validator class and a UserValidator class which extends from it.
My Validator has a public method setRule(...) with public visibility.
When I extend from it I want to change the ...
7
votes
3
answers
3k
views
Checking method visibility in PHP
Is there any way of checking if a class method has been declared as private or public?
I'm working on a controller where the url is mapped to methods in the class, and I only want to trigger the ...