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