![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| welcome YOUR NEW FRIEND RETO | retolop | UNIX for Dummies Questions & Answers | 0 | 06-13-2007 12:30 AM |
| Find a friend | Yeliu | UNIX Desktop for Dummies Questions & Answers | 2 | 09-18-2002 08:55 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
friend operator
Hello,
I have a problem by compiling a class with the following friend function in Header file: class X{ private: ...... protected: ....... public: friend ostream& operator<<(ostream& target, const PARA_DSC& para); }; the compiler output is: "X.hxx", line 346: Warning (Anachronism): Class friends require an explicit "class". "X.hxx", line 346: Error: "," expected instead of "&". 1 Error(s) and 1 Warning(s) detected. *** Error code 1 Has anybody an idea, where the problem coud be? Greetings nik |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I think you need to put the "friend" after the return value of the operator. I.e.:
ostream& friend operator<<(ostream& target, const PARA_DSC& para); If "friend" is the first token, then it expects the declaration of a friend class. |
|||
| Google The UNIX and Linux Forums |