I am trying a code which goes like this:-
class Something
{
private:
int data;
public:
Something(int data)
{
data = data;
}
int getdata()
{
return data;
}
};
int main()
{
Something xyz(5);
cout<<xyz.getdata()<<endl;
return 0;
}
The output of this is "0".
i am stuck why this is coming as 0.
kindly help.
TIA.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…