object / class methods serialized as well?
Posted
by
Mat90
on Stack Overflow
See other posts from Stack Overflow
or by Mat90
Published on 2012-03-24T13:00:47Z
Indexed on
2012/03/25
11:29 UTC
Read the original article
Hit count: 237
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.
© Stack Overflow or respective owner