Multi level inheritance, wrong virtual function called

Hello everyone,

I have a question regarding multi level inheritance.

I have three classes: Object,ObjectEdge,ObjectCircle

Object inherits from MMgt_TShared, ObjectEdge inherits from Object, ObjectCircle inherits from ObjectEdge. There is a virtual function defined in all of these classes, called Get_AIS_Object(). I store the objects in a TColStd_HSequenceOfTransient sequence. In a for loop, I loop through all the members of this sequence and call the Get_AIS_Object() function. Although the function is defined as virtual in every class, when an ObjectCircle comes in the sequence, not the function of this class is called, but the function in the superclass, so ObjectEdge. Is there a problem with multilevel inheritance in OpenCascade?

I double checked the Handle macros in the header and source files, all of them contain the right ancestors.

What is the problem?

Laszlo Kudela's picture

The good thing about posting to OpenCascade forums is that I always find the answer right after posting my question :D

The problem was solved by a simple clean and rebuild!