#include <iostream>
using namespace std;
class Foo
{
public:
int a;
};
int main()
{
Foo f;
Foo f1(f);
cout<<f.a;
return 0;
}
Here f.a prints garbage value but when we add f1.a then both f.a and f1.a is initialized with 0.
#include <iostream>
using namespace std;
class Foo
{
public:
int a;
};
int main()
{
Foo f;
Foo f1(f);
cout<<f.a<<f.b;
return 0;
}
Please help me to understand what is the reason behind this.
Aucun commentaire:
Enregistrer un commentaire