<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>friend function | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/friend-function/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 13 Mar 2010 04:29:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>c++ Program to illustrate the use of difference operators using friend function</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/#respond</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Sat, 13 Mar 2010 04:29:18 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[c++ class]]></category>
		<category><![CDATA[friend function]]></category>
		<category><![CDATA[difference operators]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1048</guid>

					<description><![CDATA[<p>AIM: A program to illustrate the use of difference operators to access the class member using friend function ALGORITHM: 1) Start the process 2) Invoke the classes 3) Call the set_xy() first a) Assign the value of x and y b) Print the value of x and y 4) Call the sum() for second(friend) a)</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/">c++ Program to illustrate the use of difference operators using friend function</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>AIM: </strong><br />
A program to illustrate the use of difference operators to access the class member using friend function<br />
<strong><br />
ALGORITHM: </strong></p>
<p>1)	Start the process<br />
2)	Invoke the classes<br />
3)	Call the set_xy() first<br />
a)	Assign the value of x and y<br />
b)	Print the value of x and y<br />
4)	Call the sum() for second(friend)<br />
a)	Again assign the temp value of x and y<br />
5)	Print the value of x and y<br />
6)	Stop the process</p>
<p><strong>PROGRAM</strong></p>
<pre lang="cpp">
#include<iostream.h>
class M
{
int x;
int y;
public:
void set_xy(int a,int b)
{
x=a;
y=b;
}
friend int sum(M m);
};
int sum(M m)
{
int M ::* px=&M :: x;
int M ::* py=&M :: y;
M *pm=&m;
int s=m.*px + pm->*py;
return s;
}
main()
{
M n;
void (M :: *pf)(int,int)=&M :: set_xy;
(n.*pf)(10,20);
cout<<"Sum="<<sum(n)<<"\n";
M *op=&n;
(op->*pf)(30,40);
cout<<"Sum="<<sum(n)<<"\n";
return(0);
}
</pre>
<p><strong>Output:</strong></p>
<p>	Sum=30<br />
	Sum=70</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/">c++ Program to illustrate the use of difference operators using friend function</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-advanced/c-program-to-illustrate-the-use-of-difference-operators-using-friend-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
