Why isn't every type of object serializable?
language-agnostic, serialization
Solution
Some objects encapsulate resources like file pointers or network sockets that can't be deserialized to the state they were in when you serialized the object that contained them.
Example: you shouldn't deserialize an object that serves as an authenticated database connection, because to do so, you'd need the serialized form to contain a plaintext password. This would not be a good practice, because someone might get a hold of the saved serialized form. You also have no idea when you deserialize that the database server is still running, can be accessed, the authentication credentials still valid, etc.
Problem
Why isn't every type of object implicitly serializable? In my limited understanding, are objects not simply stored on the heap and pointers to them on the stack? Shouldn't you be able to traverse them programatically, store them in a universal format and also be able to reconstruct them from there?