MSVC为了方便C++编写COM客户程序引入了property关键字。可能有些人不知道VC有这个功能,但是property的概念相信大家都清楚。例如:
class A
{
public:
int _width;
int get_width()
{
return _width;
}
void set_width(int value)
{
_width = value;
}
__declspec(property(get=get_width,put=set_width)) int width;
}
int main()
{
A a;
a.width = 3;
in[……]