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
How can I display text with a php script?
What is the difference between session_unregister() and session_unset()?
What is the difference between abstract class and interface in php?
What is super keyword in c++?
What are the advantages of indexes in php?
How can you send http header to the client in php?
How do I escape data before storing it into the database?
Tell me what is the meaning of a final class and a final method?
Which framework is best for php development?
How do you put a space in html?
What are the types of variables in php?
Where php basically used?
What is a variable cost example?
What is the difference between mysqli_fetch_object() and mysqli_fetch_array()?
What is isset post?