共用方式為


Type Casting of MFC Class Objects

Type casting macros provide a way to cast a given pointer to a pointer that points to an object of specific class, with or without checking that the cast is legal.

The following table lists the MFC type casting macros.

Macros That Cast Pointers to MFC Class Objects

DYNAMIC_DOWNCAST

Casts a pointer to a pointer to a class object while checking to see if the cast is legal.

STATIC_DOWNCAST

Casts a pointer to an object from one class to a pointer of a related type. In a debug build, causes an ASSERT if the object is not a "kind of" the target type.

See Also

Concepts

MFC Macros and Globals