J
James Aguilar
Suppose I have a class A that inherits from a Serializable class. Now I
have a class B that inherits from A. Now, suppose that I decide that I
would be better off having A and B inherit from a new abstract base class C
(which would itself inherit from A's parent). Here's the picture:
A <--- B
<--- A
C
<--- B
Now, suppose I want to maintain backwards compatibility. C has the field
that A used to have, and a simple readObject method works to transfer A's
field to C, but I can do no such thing with B. I'm not even strictly sure
what is happening when B is read, I just know that if I try to override
readObject with B, it cannot find the field that used to be in A. Any
advice?
- JFA1
have a class B that inherits from A. Now, suppose that I decide that I
would be better off having A and B inherit from a new abstract base class C
(which would itself inherit from A's parent). Here's the picture:
A <--- B
<--- A
C
<--- B
Now, suppose I want to maintain backwards compatibility. C has the field
that A used to have, and a simple readObject method works to transfer A's
field to C, but I can do no such thing with B. I'm not even strictly sure
what is happening when B is read, I just know that if I try to override
readObject with B, it cannot find the field that used to be in A. Any
advice?
- JFA1