Problem With friend methods 
Author Message
 Problem With friend methods

Hi.

I have a huge problem with moving from Object space STL to Microsoft STL
- all friend methods cannot use private members!!!

Know problem/ bug?

Thanks,
Adys.



Thu, 26 Apr 2001 03:00:00 GMT  
 Problem With friend methods

Quote:
>Hi.

>I have a huge problem with moving from Object space STL to Microsoft STL
>- all friend methods cannot use private members!!!

>Know problem/ bug?

        I'm assuming the problem is with classes you writing and have
control over. If so, try checking to see if a "using namespace ..."
directive appears prior to the class declaration(s). If so, try moving
the directive to just after the class declaration (or preferably to .cpp
files and out of .h files altogether). If the friend methods have std
object types as a part of their signature, this will force explicit
signatures. I've used this successfully to circumvent the problem you
describe.

BEFORE:
        using namespace std;
        class X
        {
            friend ostream& operator<< (ostream& os, const X&);
                :

AFTER:
        class X
        {
            friend std::ostream& operator<< (
                std::ostream& os, const X&);
                :
        using namespace std;

Good Luck,
Wes



Fri, 27 Apr 2001 03:00:00 GMT  
 Problem With friend methods

Hi.

For me that transition (from Object Space to MS STL and then to Borland C++
Builder 3.0 ) did not cause any  pain. If your problem was not resolved yet,

You might want to post a piece of your code as an example . Otherwise it is
hard for me to be any help.

Good luck,

Alex.

Quote:

> Hi.

> I have a huge problem with moving from Object space STL to Microsoft STL
> - all friend methods cannot use private members!!!

> Know problem/ bug?

> Thanks,
> Adys.

  anebogatov.vcf
< 1K Download


Mon, 07 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. method of a template class as a friend not working

2. Friend methods - how ?

3. friend class or just friend?

4. VC 7.1 template friend problem

5. problems with friends

6. problem with VC 6 and iostream and friend funcs

7. Friend Problem With Visual C++

8. A problem with friend functions

9. VC5 to VC6 - friend problems

10. VC++ 5 to 6 migration - problems with ostream/friend functions

11. Templates and Friends problems in VC++ 5

12. Problem with "friend" declaration in VC6

 

 
Powered by phpBB® Forum Software