S
shaanxxx
i have following class
Class A
{
public :
int a;
int b;
int c;
}
Class B
{
public :
int a;
int b;
}
can i take pointer of type *B and point to class A Object and
successfully modify Data member a and b of A . What standard has to
say about it ?
B * ptr = reinterpret_cast<B*>( new A );
Are Data members laid in memory in order in which they are declared ?
Class A
{
public :
int a;
int b;
int c;
}
Class B
{
public :
int a;
int b;
}
can i take pointer of type *B and point to class A Object and
successfully modify Data member a and b of A . What standard has to
say about it ?
B * ptr = reinterpret_cast<B*>( new A );
Are Data members laid in memory in order in which they are declared ?