DiscussionsIssue archiveOther usage issues

Archived discussion

Multi level inheritance, wrong virtual function called

Other usage issuesThu, 10/04/2012 - 19:111 reply

Browse this forum
QuestionAuthor

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?

Discussion

1 archived reply

Posts are displayed in their archived order.

01Author

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!