Suppose I have a base struct
FOO
which is essentially a C-style struct
:
struct FOO
{
double bar1;
int bar2;
};
And a C++ style struct
(which has member functions, no member data, but no v-table):
struct bar : public FOO
{
double getBar1() const;
int getBar2() const;
};
I then have a pointer FOO* f
, which is actually a FOO
: it was created using FOO* f = new FOO()
; Is the C-style cast bar* b = (bar*)(f)
defined?
Apologies: bar
does not contain any data members