Answer Posted / damodar narayan
Visibility
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.
The policy is if you are not a member, you can’t get it. But there is a certain situation wherein you need to share your private or protected data with nonmembers. ‘Friends’ come here as a rescue.
A friend function is a non-member function that grants access to class’s private and protected members.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Tell me what is the main difference between php 4 and php 5?
What is mysql_fetch_row?
What are differences between PECL and PEAR?
What is php built on?
Tell me what is the use of "enctype" attribute in a html form?
How to check a key exist in an array?
Explain whether it is possible to share a single instance of a memcache between multiple php projects?
What are the two most common ways to start and finish a php block of code?
What is $globals php?
What does sign mean php?
What is the use of hooks?
What is config file in php?
Explain me what is the difference between explode() and split() functions?
Which php framework is best for security?
How do functions work?