Regarding friend function in c++
I have doubt in a program Suppose there are three c++ file named as
A.cpp, B.cpp and Friend.cpp
Let
A.cpp
has code inside as
class A
{ private:
int a=10,b=20;
public friend void display(.....);
};
void display(A x
{
cout<<x.a<<x.b;
}
Then let
B.cpp has
class B
{
// some function
}
Finally
Friend.cpp has
int main()
{
A a;
cout<<display(a);
}
Can anyone say me how to bind all these cpp file and execute these
programs without error? Help me guys
No comments:
Post a Comment