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
What is the use of mysqli_real_escape_string() function?
Which is a perfect example of runtime polymorphism?
Are react hooks stable?
Is php a case sensitive language?
What are the different types of php variables?
How to connect to a url in php?
How can I display text with a php script?
Do while loops php?
What is the most common http method?
What is difference between php and wordpress?
Write a program to display a table of any given number?
Do you know what is the function mysql_pconnect() usefull for?
What is difference between print_r and echo in php?
How many types of inheritances used in php and how we achieve it.
Why does sql injection happen?