Did I do this correctly?

Modify the following code to:
Declare class A to be a friend of class B.
Declare function double compute(A& data) to be a friend of class A.

1
2
3
4
5
6
7
8
9
class A
{
friend double compute (A& data)
};

class B
{
friend class A;
};
Declare class A to be a friend of class B.

This is generally done on the stack, I'm having trouble remembering if it makes a difference. I don't think it does.

Declare function double compute(A& data) to be a friend of class A.

You're missing a semicolon at the end of Line 3.
friend double compute (A& data)

so this is the correct format? for :Declare function double compute(A& data) to be a friend of class A.
Topic archived. No new replies allowed.