Article ID: 192539
Article Last Modified on 10/7/2005
Date Time Size File Name Version# Platform ----------------------------------------------------------------- 9/15/98 08:26p 1,183,795 C1xx.dll 12.00.8257.0 (x86)
194022 Visual Studio 6.0 service packs, what, where, why
194295 How to tell that a Visual Studio service pack is installed
// test1.cpp
// Compiler options needed: cl /c /GX
#include <iostream>
using namespace std;
#ifdef WORKAROUND
class CMyClass;
ostream& operator <<(ostream &, const CMyClass &);
#endif // WORKAROUND
class CMyClass
{
public:
friend ostream& operator <<(ostream &, const CMyClass &);
// An alternative workaround is to define the operator in the
// class declaration. In this case it is not necessary to forward
// declare the class and friend function.
private:
int value;
};
ostream& operator <<(ostream& out, const CMyClass& m)
{
int i = m.value; // C2248 Error
return out;
}
void main()
{ }
// test2.cpp
// Compiler options needed: cl /c /GX
#include <iostream>
using namespace std;
#ifdef WORKAROUND
int operator+(int, const class &);
#endif // WORKAROUND
class CMyClass
{
public:
friend int operator+(int, const CMyClass &); // C1001 Error.
};
void main()
{ }
Keywords: kberrmsg kbbug kbfix kblangcpp kbqfe kbvs600sp3fix kbhotfixserver KB192539