[odb-users] Problem with pointer in base class

Lidia Kalinovsky lidia at lemur-soft.com
Wed Jul 3 12:57:47 EDT 2013


may be i am wrong, but i think you need define your base class with #pragma
db object polymorphic



On Wed, Jul 3, 2013 at 6:12 PM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> 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
>
>


-- 
Software integration and outsourcing services,
Lemur-Soft, Giv'at Nili
Israel, 37825
Phone : (+972) 545748325
Fax : (+972) 775345383
Email : lidia at lemur-soft.com
Web: www.lemur-soft.com


More information about the odb-users mailing list