Hello!
Im having a problem with the following code structure. The code compiles without problems but when i start the program i get an "exception: __non_rtti_object at memory location...". In the constructor of the model-class i still can get the object information of the node-class through the base pointer. Once the construction of the model-object is completed the class information somehow got lost. I would be very grateful if somebody could point the problem out. Thanks!
int main( )
{
Node* x = new Node();
x->setName("this is a node");
Model* m = new Model(x);
cout << typeid(*m->getDataNodePath().getLastPathComponent()).name() << endl; // exception: __non_rtti_object at memory location...
delete m;
delete x;
}
the fault is all in template class Path.
when you write dataNodePath = new Path<BaseNode * const>(node); in "Model.h",
you are actually initiating dataNodePath with &node.However, node is a temporary argument.