axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sérgio Gomes" <>
Subject Polymorphism in Axis2/C
Date Wed, 23 Apr 2008 14:32:40 GMT
Hi there,

First of all let me explain what I'm trying to do and what's
happening. I have a method that receives an abstract type A. Of
course, being an abstract type, it's not meant to be instantiated;
there are instead other two types, A1 and A2, which are not abstract,
and inherit from A.

The problem is, when I provide an object of type A1 or A2 to the
method, I have to cast it to A, and the serialization code will write
it to the XML document as an A, thereby losing all the specific
properties of the derived type and effectively sending an abstract
type as the method parameter. If the serialization code for the
derived type was used instead of the base class's, it would work. The
problem can be generalized to any hierarchy of abstract or concrete
types being passed as parameters or returned as results.

I can see two solutions to this: one of them is by having each object
contain pointers to the serialization/deserialization functions of its
own type, and using those pointers every time we want to
serialize/deserialize. The other one is by making the objects aware of
their own type and having the superclasse's
serialization/deserialization functions call the appropriate type's
functions (this would likely get quite complex very quickly in
multi-level hierarchies).

I'm willing to implement these changes myself, but I'd like to hear
some comments regarding the several options and the whole concept.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message