Ex 3
Ex 3
#include<iostream>
using namespace std;
int main()
{
Shape rec;
rec.getInput();
rectangleArea (rec); //friend function call
return 0;
}
Ex: 3. A) Program to implement friend function
Sample 2: Program implementing friend function to find the sum of private int and float
members of two different classes
#include<iostream>
using namespace std;
obj1.getInputs();
obj2.getInputs();
obj1.displayValues();
obj2.displayValues();
return 0;
}