Link to home
Start Free TrialLog in
Avatar of DJ_AM_Juicebox
DJ_AM_Juicebox

asked on

Serialization of base type

Hi,

Is it possible to do something like:

class Parent implements Serializable {
}
class Child extends Parent {
}

void Serialize()
{
    Child c = new Child();
    byte[] b = c.serializeToByteArray();

    Deserialize(b);
}

void Deserialize(byte[] b)
{
    Parent p = (Parent)b.deserialize();
}

Just wondering...

Thanks
Avatar of oleber
oleber
Flag of Portugal image

I'm a litle lost.

You wont to clone the Child class.

If it is that, you can serialize the Child and after do the unserialize and you got the clone.
ASKER CERTIFIED SOLUTION
Avatar of Ajay-Singh
Ajay-Singh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial