Hi, Since your QueueObject's Q is a queue, it can't hold the IntDoublePairs, even though they're descended from RequestObject. Only dynamic variables can hold the descendants of their type. In order to do this, you will need to make Q a queue, and dynamically allocate memory for the RequestObjects you put into it. Hope this helps.
aaragon Hello all, I think the problem I'm facing is hard so I wonder if someone faced it before and if there is a simple solution to it. I am creating a program that basically takes all the required information at runtime after reading a file. After reading the file, several objects of a templated ClassA are created. I thought that ...
> [redacted] } > ... > I get the following warning (and the program crashes): > warning c4541: 'dynamic_cast' used on polymorphic type 'main::A' with /GR-; unpredictable behaviour may result > > .... > > Well, why doesn't this work. If class B is derived from A (and holds one internal instance of A because of virtual), then a dynamic cast ...
Code: class A {}; class B {}; class X : public A, public B {}; class Y : public A {}; I have a list of A*. Is it possible to check if the derived class(es) at any point has B as a base class? (X and Y may be multiple classes derived from the previous one in succession where any ...