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
Explain some of the php array functions?
What is traits? How it is used in php?
Is c similar to php?
What is difference between explode() or split() in PHP?
Why session is required?
How to turn on the session support in php?
What is the method to register a variable into a session?
What are the difference between overloading and overriding in oops?
Explain the advantages of using PHP?
How php statement is different from php script?
Which function is used in php to count the total number of rows returned by any query?
What does addslashes do in php?
How stop the execution of a php scrip?
Tell me how to set a page as a home page in a php based site?
What are the special characters you need to escape in single-quoted stings?