This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FRIEND FUNCTION | |
#include<iostream> | |
#include<conio.h> | |
using namespace std; | |
class rect | |
{ | |
int length; | |
public: | |
rect(int c) | |
{ | |
length=c; | |
} | |
friend void display(rect); | |
}; | |
void display(rect d) | |
{ | |
int x; | |
x=d.length+10; | |
cout<<"length\t"<<x; | |
} | |
int main() | |
{ | |
rect a(5); | |
display(a); | |
getch(); | |
return 0; | |
} |
Comments
Post a Comment
Thanks for the comment and don't forget to subscribe.