Share via


CObject::CObject

CObject();

CObject(constCObject&objectSrc);

Parameters

objectSrc

A reference to another CObject

Remarks

These functions are the standard CObject constructors. The default version is automatically called by the constructor of your derived class.

If your class is serializable (it incorporates the IMPLEMENT_SERIAL macro), then you must have a default constructor (a constructor with no arguments) in your class declaration. If you do not need a default constructor, declare a private or protected “empty” constructor. For more information, see in Visual C++ Programmer’s Guide.

The standard C++ default class copy constructor does a member-by-member copy. The presence of the private CObject copy constructor guarantees a compiler error message if the copy constructor of your class is needed but not available. You must therefore provide a copy constructor if your class requires this capability.

Example

See CObList::CObList for a listing of the CAge class used in the CObject examples.

// Create a CAge object using the default constructor.
CAge age1;

// Create a CAge object using the copy constructor.
CAge age2( age1 );

CObject OverviewClass MembersHierarchy Chart