Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Friend Class Practice

Sunday, June 12, 2011


#include<iostream>
using namespace std;
#include<conio.h>
//class d;
class a
{private:
int c,b;
public:
a()
{
c=b=4;
}
friend class d;
};
class d
{public:
void sum(a ob)
{
int summ=ob.c+ob.b;
cout<<"sum is"<<summ;

}
};
void main()
{
a ob;
d ob1;
ob1.sum(ob);
_getch();
}