I have a structure like this
struct structure
{
BaseObject &A; //BaseObject has a function declared as virtual
};
In run time, I am dynamically assign an object to &A
structure *s = new structure;
DerivedObjectB *B = new DerivedObjectB(); //Derived class overloads the virtual function
s->A = *B; //s is a pointer of the structure. S has been initialized
I can compile this code but I am getting a seg-fault error in runtime. I have a restriction that I can not use a pointer. This is not a homework. The compiler I am using as a reverse compiler has a restriction of using pointers because of an issue in building SSA