Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of friend function?

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


Please Help Members By Posting Answers For Below Questions

What is the use of mysqli_real_escape_string() function?

983


Which is a perfect example of runtime polymorphism?

1037


Are react hooks stable?

1003


Is php a case sensitive language?

1221


What are the different types of php variables?

1119


How to connect to a url in php?

1048


How can I display text with a php script?

1152


Do while loops php?

1022


What is the most common http method?

1149


What is difference between php and wordpress?

1252


Write a program to display a table of any given number?

1001


Do you know what is the function mysql_pconnect() usefull for?

1008


What is difference between print_r and echo in php?

939


How many types of inheritances used in php and how we achieve it.

1005


Why does sql injection happen?

1061