friend02.C revision 1.1.1.1
1// { dg-do assemble } 2//980610 bkoz 3// example 2: ok 4 5class bar; 6class foo { 7public: 8 int func(bar *); 9 foo(){} 10 ~foo(){} 11}; 12 13class bar { 14 int st; 15public: 16 bar(){st=12;} 17 ~bar(){} 18 friend int foo::func(bar *); 19}; 20 21int foo::func(bar *obj) { 22 obj->st++; 23 return (obj->st); 24} 25 26void test02() { 27 foo obj_f; 28 bar obj_b; 29 30 obj_f.func( &obj_b); 31} 32