Code: C++
#include<iostream.h>
#include<conio.h>
using namespace std;
struct emp
{
private:
int h;
public:
void setdata(int a)
{
h = a;
cout<<h;
}
}emp1;
main()
{
emp1.setdata(5);
getch();
}
Hello there,
I wanted to know if there is any way by which I can view the emp1 member value (without omitting private specifier) like this :
cout<<emp1.h;
thanx !