Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
MFC
Classes
CObject Class
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
MFC Library Reference 
CObject Class 

The principal base class for the Microsoft Foundation Class Library.

class AFX_NOVTABLE CObject

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

  • Compatibility with collection classes

Note that 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, however, to have structures and non-CObject-derived classes in right-hand multiple-inheritance branches.

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 information about deriving Microsoft Foundation classes and C++ classes in general and using CObject, see Using CObject and Serialization.

Header: afx.h

CObject::Dump is not supported in smart device projects because CDumpContext Class is not supported in smart device projects.

Reference

Hierarchy Chart

Other Resources

CObject Members

Tags What's this?: cobject (x) mfc (x) Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
CObject MFC      devzang   |   Edit   |   Show History
CObject MFC
Tags What's this?: cobject (x) mfc (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker