Member Function Same Name Void Return Type
Member Function Same Name Void Return Type
Q2. Write a program using two classes, one for circle and the other for sphere.
Use member functions to calculate the area of both objects.
Friend Function:
if (v.life = = 1)
cout<<"\nA virus is alive.";
}
Example 4: Friend Function
class Tutorial int Add (int x)
{ {
int data; Tutorial var1;
friend int Add (int x); return var1.data + x;
}
public:
Tutorial ( )
{
void main( )
data = 5;
{
}
cout<<"Result"<<Add(4)<<endl;
};
getch();
}
REMEMBER :