I know that data members are saved to disk but I was wondering whether object's/class' methods are saved in binary format as well? Because I found some contradictionary info, for example:
Ivor Horton: "Class objects contain function members as well as data members, and all the members, both data and functions, have access specifiers; therefore, to record objects in an external file, the information written to the file must contain complete specifications of all the class structures involved."
and:
Are methods also serialized along with the data members in .NET?
Thus: are method's assembly instructions (opcodes and operands) stored to disk as well? Just like a precompiled LIB or DLL? During the DOS ages I used assembly so now and then.
As far as I remember from Delphi and the following site (answer by dan04):
Are methods also serialized along with the data members in .NET?
sizeof(<OBJECT or CLASS>)
will give the size of all data members together (no methods/procedures). Also a nice C example is given there with data and members declared in one class/struct but at runtime these methods are separate procedures acting on a struct of data. However, I think that later class/object implementations like Pascal's VMT may be different in memory.
No, the methods are saved.
Only the information required to be able to restore the objects to their previous states.
So any value field and prop will be saved (assuming you are using binary serializer), but in no case the methods will be.