Declare Serial Mfc

Declare Serial Mfc 8,1/10 65votes
Declare Serial Mfc

Note If you forget to define a constructor with no arguments in a class that uses the DECLARE_SERIAL and IMPLEMENT_SERIAL macros, you will get a 'no default constructor available' compiler warning on the line where the IMPLEMENT_SERIAL macro is used. Using the IMPLEMENT_SERIAL Macro in the Implementation File The IMPLEMENT_SERIAL macro is used to define the various functions needed when you derive a serializable class from CObject. You use this macro in the implementation file (. My Real Font Pro Apk Download more. CPP) for your class. The first two arguments to the macro are the name of the class and the name of its immediate base class. Cimplicity Demo Software Download. The third argument to this macro is a schema number. Enga Veetu Pillai Audio Songs Download.

The schema number is essentially a version number for objects of the class. Use an integer greater than or equal to 0 for the schema number. (Don't confuse this schema number with database terminology.) The MFC serialization code checks the schema number when reading objects into memory. If the schema number of the object on disk does not match the schema number of the class in memory, the library will throw a CArchiveException, preventing your program from reading an incorrect version of the object. If you want your Serialize member function to be able to read multiple versions — that is, files written with different versions of the application — you can use the value VERSIONABLE_SCHEMA as an argument to the IMPLEMENT_SERIAL macro. For usage information and an example, see the GetObjectSchema member function of class CArchive. The following example shows how to use IMPLEMENT_SERIAL for a class, CPerson, that is derived from CObject: IMPLEMENT_SERIAL( CPerson, CObject, 1 ) Once you have a serializable class, you can serialize objects of the class, as discussed in the article.