$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Marco Servetto (marco.servetto_at_[hidden])
Date: 2007-09-22 01:38:39
Hello,
Supposing having
struct A{
int a1;
double a2;
int a3[3];
};
struct B{
int b1;
double b2;
int b3[3];
};
A and B are two structure with same strucutural type but different
name, (and different name for fields...)
The question is: C++ grants that
A a;
a.a2=8.8;
assert(reinterpret_cast<B*>(&a)->b2==8.8);
If the response is yes,
it is even true for classes with inheritance?
that is A1,B1,C1 have same struttural type of A2,B2,C2 and
class A1 :public B1, class B1: public C1
and
class A2 :public B2, class B2: public C2
can i safaly reinterpreter cast from A1 to A2 and acceding public
fields (of A1,B1,C1)
trought the field names of A2?
Thanks in advance for your help.