• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serializing objects

 
ryan burgdorfer
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When writing a vector of my own objects out to a file, do the objects need to be serializable even though it is actually the vector I am outputting?
Also, each of my objects in this vector have a field that is a vector of other objects...do I need to declare those objects serializable also?
E pluribus unum
Thanks!
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ryan,
You sure do. The serialized method is a recursive method that will go through and serialize your collection and all object it contains. A vector of vector is just an object containing objects that can hold other objects. You can have vector of vector of vector...Each object has to implement the Serializable interface.
-Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!