[odb-users] Problem with pointer in base class

Boris Kolpackov boris at codesynthesis.com
Wed Jul 3 11:12:23 EDT 2013


Hi John,

Ball, John R <jrball at sandia.gov> writes:

> Consider a base class Foo that references another base class Bar by
> pointer. The pointer is held by the Foo base and is instantiated on
> the Bar base class. We now want to have parallel specialization
> hierarchies for Foo and Bar.

I am confused by your terminology: do you mean template
specializations? Maybe you mean "derivation" instead of 
"specialization"? I.e., you have parallel inheritance
hierarchies starting with the Foo and Bar base classes?


> When we store Foo and Bar specializations, they of course go into 
> individual tables. However, since the pointer is held by the Foo
> base class and instantiated on the Bar base class, ODB can't find
> the Bar specialization objects to resolve the pointer.

Yes, I am pretty sure you are talking about inheritance 
hierarchies here. And you are using reuse-style inheritance
support in ODB. I think polymorphic inheritance will work much
better in this situation. With polymorphic inheritance, any
(derived) Foo object can reference any (derived) Bar object.
See Section 8.2, "Polymorphism Inheritance" in the ODB manual
for more information on this inheritance style.

If, however, I am completely wrong about what you trying to
achieve, then can you show some sample class declarations (e.g.,
for Foo and Bar and for a few of their "specializations")?

Boris



More information about the odb-users mailing list