SORRY I had type the code on a cell phone which lead to few auto-corrects along with some missing parts, here is the complete code:
Code:
#include<iostream>
using namespace std;
class a{
int q;
int w;
char e;
public:
a(int i, int j, char c): q(i),w(j),e(c)
{
cout<<" i = "<<q<<endl;
cout<<" j = "<<w<<endl;
cout<<" c = "<<e<<"\n"<<endl;
}
void b()
{
cout<<" i = "<<q<<endl;
cout<<" j = "<<w<<endl;
cout<<" c = "<<e<<"\n"<<endl;
}
};
int main()
{
a obj(1,2,'c');
int *i ;
i = (int *)&obj;
*(i+0)=90;
*(i+1)=89;
*(i+2)='z';
obj.b();
return 0;
}
OUTPUT:
i = 1
j = 2
C = y
i = 90
j = 89
C = z