MY name is ruhul amin

ISLAMIC UNIVERSITY OF KUSHTIA

Wednesday, March 27, 2013

discribtion of friend class

#include <iostream>
#include<cstring>
#define max 1000
using namespace std;
class name1
{
    private:
    char a[max],c[max];
    int la,d;
    public:
    void member()
    {
        cin.get(a,max);
        la=strlen(a);
        d=la;
        for(int j=0;j<d;j++)
        c[j]=a[j];
    }
 friend class name2;
};
class name2
{
    private:
    char b[max];
    int c;
    public:
    void member1(name1&la)
    {
    c=la.d;
    for(int i=0;i<c;i++)
    {
    b[i]=la.c[i];
    cout<<b[i];
    }
    }
};
int main()
{
    name1 ob;
    name2 ot;
    ob.member();
    ot.member1(ob);
    return 0;
}

No comments:

Post a Comment