Compartilhar via


property (Windows CE 5.0)

Send Feedback

The __declspec( property) extended storage-class modifier tells the compiler to treat the specified property as a virtual data member, and to change related references into function calls.

__declspec( property( get=get_func_name ) ) declarator__declspec( property( put=put_func_name ) ) declarator__declspec( property( get=get_func_name, put=put_func_name ) ) declarator

This attribute can be applied to nonstatic virtual data members in a class or structure definition.

When the compiler sees a data member declared with this attribute on the right of a member-selection operator such as "." or "->", it converts the operation to a get or put function, depending on whether such an expression is an l-value or an r-value. In more complicated contexts, such as "+=", a rewrite is performed by doing both get and put.

This attribute can also be used in the declaration of an empty array in a class or structure definition.

The following code example statement indicates that x[] can be used with one or more array indices.

In this case, i=p->x[a][b] is turned into i=p->GetX(a, b), and p->x[a][b] = i is turned into p->PutX(a, b, i).

__declspec(property(get=GetX, put=PutX)) int x[];

See Also

__declspec

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.