#include<iostream>
#include<fstream>
using namespace std;
class Integer {
public:
int val;
Integer(int val = 0) {
this->val = val;
}
void setVal(int val) {
this->val = val;
}
};
int main()
{
int val;
Integer i;
i.setVal(8);
cout << val << endl;
}
When I execute my code I got 0
.I am new to C++,I do not understand this
. Can someone elaborate more regarding this issues?