ASSERT_VALID Macro

Syntax

ASSERT_VALID( object );

Parameters

object

An object of a class derived from CObject and with an overriding version of the AssertValid member function.

Remarks

Use to test your assumptions about the validity of an object's internal state. ASSERT_VALID calls the AssertValid member function of the object passed as its argument. By default, the AssertValid member function of class CObject is called, but typically you override AssertValid in classes that you derive from CObject so the overriding version will be called. In your AssertValid override, you can test the object's internal validity. For example, if the object represents a linked list, you could verify that the head and tail pointers are NULL if the list is empty and not NULL if the list is not empty.

For more information and examples, see the Class Libraries User's Guide, Chapters 4 and 11, “Phone Book: A Simple Windows Database,” and “Diagnostics.”

See Also

ASSERT, VERIFY, CObject, CObject::AssertValid