Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
class CObject
◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
Description
CObject is the principal base class for the Microsoft Foundation Class
Library. It serves as the root not only for library classes such as
CFile and CObList, but also for the classes that you write. CObject
provides basic services, including:
■ Serialization Support
■ Run-Time Class Information
■ Object Diagnostic Output
■ CObjects and Collection Classes
NOTE: CObject does not support multiple inheritance. Your derived
classes can have only one CObject base class, and that CObject
must be leftmost in the hierarchy. It is permissible, though, to
have structures and non-CObject-derived classes in right-hand
multiple-inheritance branches.
#include <afx.h>
Derivation
You will realize major benefits from CObject derivation if you use some
of the optional macros in your class implementation and declarations.
The first-level macros, DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC, permit
run-time access to the class name and its position in the hierarchy.
This, in turn, allows meaningful diagnostic dumping.
The second-level macros, DECLARE_SERIAL and IMPLEMENT_SERIAL, include
all the functionality of the first-level macros, and they enable an
object to be "serialized" to and from an "archive."
For important information about deriving Microsoft Foundation classes
and C++ classes in general, see "How to Derive a Class from CObject" in
Chapter 8 of the <Class Libraries User's Guide>.
Public Members
Construction/Destruction
◄~CObject► Virtual destructor.
◄operator new► Special new operator.
◄operator delete► Special delete operator.
Diagnostics
◄AssertValid► Validates this object's integrity.
◄Dump► Produces a diagnostic dump of this object.
Serialization
◄IsSerializable► Tests to see if this object can be serialized.
◄Serialize► Loads or stores an object from/to an archive.
Miscellaneous
◄GetRuntimeClass► Returns the CRuntimeClass structure corresponding to
this object's class.
◄IsKindOf► Tests this object's relationship to a given class.
Protected Members
◄CObject► Default constructor.
Private Members
◄CObject► Copy constructor.
◄operator =► Assignment operator.
Macros
◄RUNTIME_CLASS► Returns the CRuntimeClass structure
corresponding to the named class.
◄DECLARE_DYNAMIC► Permits access to run-time class information
(used in each class declaration).
◄IMPLEMENT_DYNAMIC► Permits access to run-time class information
(used once in the class implementation).
◄DECLARE_SERIAL Macro► Permits serialization and access to run-time
class information (used in each class
declaration).
◄IMPLEMENT_SERIAL Macro► Permits serialization and access to run-time
class information (used once in the class
implementation).
-♦-