A
Aaron Fude
Suppose that on the "server", I have the following code:
ObjectInputStream in = new
ObjectInputStream(coming.from.wherever);
ClassA obj= (ClassA) in.readObject();
and I send via the input stream an instance of ClassB that extends
ClassA, but ClassB is not in the classpath of the "server". Should
this work? I would have thought "yes", but I tried it and the answer
is "no".
I have found a workaround so that's not what I am looking for, but I'm
hoping that, through an explanation, I will learn something new.
I see a little bit of what's wrong here. The "server" may want to call
a function on "obj" that's been overridden in ClassB and it doesn't
have access to that code. But is there a way to supply the code the
the "server" as well?
Thanks!
Aaron
ObjectInputStream in = new
ObjectInputStream(coming.from.wherever);
ClassA obj= (ClassA) in.readObject();
and I send via the input stream an instance of ClassB that extends
ClassA, but ClassB is not in the classpath of the "server". Should
this work? I would have thought "yes", but I tried it and the answer
is "no".
I have found a workaround so that's not what I am looking for, but I'm
hoping that, through an explanation, I will learn something new.
I see a little bit of what's wrong here. The "server" may want to call
a function on "obj" that's been overridden in ClassB and it doesn't
have access to that code. But is there a way to supply the code the
the "server" as well?
Thanks!
Aaron