Question: Whats wrong with the following attempts at establishing friends? a. class snap { friend clasp; ... }; class clasp { ... }; b. class cuff

What’s wrong with the following attempts at establishing friends?
a. class snap {
friend clasp;
...
};
class clasp { ... };
b. class cuff {
public:
void snip(muff &) { ... }
...

};
class muff {
friend void cuff::snip(muff &);
...
};
c. class muff {
friend void cuff::snip(muff &);
...
};
class cuff {
public:
void snip(muff &) { ... }
...
};

Step by Step Solution

3.54 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Its illformed because a friend specifier cannot appear in a class definition C03 1... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction Java Program Questions!