1,105,538 Community Members

merits & demerits of friend functions

Member Avatar
Kushal Thakkar
Newbie Poster
4 posts since Feb 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

can anyone tell me the merits & demerits of friend functions?
p.s. help me
kushal

Member Avatar
Clinton Portis
Practically a Posting Shark
831 posts since Oct 2005
Reputation Points: 211 [?]
Q&As Helped to Solve: 120 [?]
Skill Endorsements: 8 [?]
 
1
 

the only time i can think of using friend functions is for operator overloading.. the rest of the time they should be avoided because they violate OOP data encapsulation.

Member Avatar
Narue
Bad Cop
12,139 posts since Sep 2004
Reputation Points: 5,693 [?]
Q&As Helped to Solve: 1,537 [?]
Skill Endorsements: 81 [?]
Team Colleague
 
0
 

>the rest of the time they should be avoided because they violate OOP data encapsulation.
If this is what you think, then you're not in a position to help. Those who still need to learn shouldn't be teaching.

Member Avatar
Bench
Posting Pro
575 posts since Feb 2006
Reputation Points: 212 [?]
Q&As Helped to Solve: 64 [?]
Skill Endorsements: 0 [?]
 
0
 

Both the OP and the 1st reply could benefit from this link
http://www.parashift.com/c++-faq-lite/friends.html

Member Avatar
SpS
Posting Pro
598 posts since Aug 2005
Reputation Points: 34 [?]
Q&As Helped to Solve: 33 [?]
Skill Endorsements: 0 [?]
 
0
 
Member Avatar
Kushal Thakkar
Newbie Poster
4 posts since Feb 2006
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thanxs sunnypalsingh, it was a great help...

Member Avatar
supriya kalekar
Newbie Poster
1 post since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-1
 

what r merits & demerits of friend function

Member Avatar
himanshu shekha
Newbie Poster
1 post since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
-2
 

please tell me merits and demerits of friend function

Member Avatar
Dave Sinkula
long time no c
4,852 posts since Apr 2004
Reputation Points: 2,398 [?]
Q&As Helped to Solve: 340 [?]
Skill Endorsements: 69 [?]
Team Colleague
 
2
 

Uh. Follow the links posted already in the thread? (Try not to be an unthinking idiot who is not inclined to read the replies already posted here.)

Member Avatar
Dave Sinkula
long time no c
4,852 posts since Apr 2004
Reputation Points: 2,398 [?]
Q&As Helped to Solve: 340 [?]
Skill Endorsements: 69 [?]
Team Colleague
 
0
 

Uh. Follow the links posted already in the thread? (Try not to be an unthinking idiot who is not inclined to read the replies already posted here.)

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article