Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialization question

 
Mike Mitchell
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. I was trying to whip something up to demonstrate that if a serializable object's parent is not serializable, than any inherited attributes will not be serialized.

However, when I run TestSerial below, I get the following exception. Having trouble understanding why. Anybody see the problem? If I make Food implement Serializable, it runs without exception.

Thanks much,
Mike




[ July 20, 2008: Message edited by: Mike Mitchell ]
 
Don Solomon
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Mike,
I had to add a default constructor to Food Class for your program to work; which I believe is a requirement for non-Serializable supers.

Anyone correct me if I am wrong.

Thanks
[ July 20, 2008: Message edited by: Don Solomon ]
 
kaushik vira
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya.. Default constructor in parent class is mandatory if you are relaying on default serialization.
 
Mike Mitchell
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Don and Kaushik. That was it -- I needed a default constructor in the non-serializable super class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic