Thursday 29 April 2021

Friend Function in C++ Qus - 3

 #include<iostream.h>

#include<conio.h>

class A

{

int a, b;

void display()

{

cout<<"Display"<<endl;

}

public:

void display1()

{

cout<<"Display-1"<<endl;

}

friend void show();


};


void show()

{

A ob;

ob.display();

ob.display1();

ob.a=5;

ob.b=10;

cout<<ob.a+ob.b<<endl;

}


main()

{

clrscr();

show();

getch();

return 0;

}

No comments:

Post a Comment