Article ID: 152055
Article Last Modified on 7/5/2005
/* Compile options needed: none
*/
#include <iostream.h>
class MyClass
{
public:
int m_n;
// No declaration of a default constructor
};
MyClass::MyClass() : // C2600 here.
m_n (42)
{
}
void main()
{
MyClass t; // Default constructor is not called
cout << "m_n is " << t.m_n << endl;
cout << "It should be 42 ";
cout << "if the correct default constructor was called." << endl;
}
Visual C++ 5.0 generates the following error when compiling
the sample code above:
Additional query words: kbVC400bug
Keywords: kbbug kbfix kblangcpp kbvc500fix kbcpponly kbcompiler KB152055