Compartilhar via


Pointers to Base-Class Members

A pointer to a member of a base class can be converted to a pointer to a member of a class derived from it, when the following conditions are met:

  • The inverse conversion, from pointer to derived class to base-class pointer, is accessible.

  • The derived class does not inherit virtually from the base class.

When the left operand is a pointer to member, the right operand must be of pointer-to-member type or be a constant expression that evaluates to 0. This assignment is valid only in the following cases:

  • The right operand is a pointer to a member of the same class as the left operand.

  • The left operand is a pointer to a member of a class derived publicly and unambiguously from the class of the right operand.

See Also

Reference

Pointer-to-Member Conversions