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. Cheers, Sérgio --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
