We know that compiler generates some member functions for user-defined class if that member functions are not defined but used, isn't it. So I have this kind of code:
class AA
{
};
void main()
{
AA a;
AA b(a);
a = b;
}
This code works fine. I mean no compiler error. But the following code....
class AA
{
int member1;
int member2;
};
But this code gives an run time error, because variable "a" is used without being iniltialized!!!
So my question is this: when we instantiate an int, it has a value. So why the default constructer doesn't work and by using those two int numbers initializes variable "a"??
EDIT: Platform: Win Vista, Compiler: Visual Studio 2008 compiler; Flags: Default