If a class is serializable , then all its sub classes are also serializable right?
If a class is serializable , then all its sub classes are also serializable right?
Yes, that's right
Ulf Dittmer wrote:No, it's not. What a subclass does has no bearing on the superclass.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
John Drulo wrote:If a class is serializable , then all its sub classes are also serializable right? (it is stated so at pg 440 in the book.)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Tushar Goel wrote:I tested following condition:
1) Super class is not serialized but sub class is:
output : Super class variables showing default value instead of the value i set them and for sub class it showing same value i set.
2) Super class is serialized but sub class is not explicitly:
output : All variables showing same value i set.
3) Now i created 1 more subclass (1 <- 2 <- 3) , total have 3 class, 1 is not serialized, 2nd is and in 3rd i mentioned explicitly
output : variables used in 1st class showing default value instead of value i set and rest of variables defined in subclass 2 and its subclass 3 showing
the value i set.
John Drulo wrote:If a superclass implements Serializable, all its sub classes also implicitly implement Serializable and hence are Serializable, thereby adhering to the rules of inheritance in Object Oriented Design Paradigm. Also, the interface Serializable is no different from other interfaces, atleast with regards to inheritance in this context.
Am I right?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |