?
Solved

Serialization of base type

Posted on 2008-02-09
2
Medium Priority
?
241 Views
Last Modified: 2010-07-27
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
0
Comment
Question by:DJ_AM_Juicebox
2 Comments
 
LVL 10

Expert Comment

by:oleber
ID: 20860607
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.
0
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 2000 total points
ID: 20863347
If you are using java serialization, its quite possible. You don't need the
extra method Serialize/Deserialize
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month6 days, 20 hours left to enroll

594 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question