leo@aai.com (07/24/90)
We're busily learning C++ from Lippman's book while building an application. We do a lot of grahics here and we have a need for a generic pointer to an object. The equivalent in C would be a char* pointer, i.e., a pointer that could point to anything. The reason why we need such a contruct is because there are graphical objects that are created at run-time. Some of these objects are totally unrelated to each other so they should not all share a common base class. In fact, I experimented with that approach, but we had problems with the virtual methods in the base class being executed instead of the appropriate ones, since the parameters where the same in the derived and base classes. Are we overlooking something obvious here? How can we build, let's say, a list, that contains pointers to unrelated objects? I have it working for derived objects by using g++'s genclass to make an SLList instance of pointers to the base class. But how do we put objects not derived from the same base class on the same list? We're using g++ 1.37, if it makes any difference. Thanks for any advice! -- Leo leo@aai.com leo%aai@uunet.uu.net ...uunet!aai!leo -- Leo leo@aai.com leo%aai@uunet.uu.net ...uunet!aai!leo