Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A;
- class B{
- int inf;
- public:
- void set_inf(int a){
- inf=a;
- }
- int get_inf(){
- return inf;
- }
- friend class A;
- };
- class A{
- char c;
- public:
- int infout(B obj){
- return obj.get_inf();
- }
- };
- int main(){
- A one;
- B two;
- two.set_inf(42);
- cout<<one.A::infout(two)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment