Borland C++ Builder 對 C++ 進行了擴充,也可以象 Delphi 中一樣自定義類屬性。 對于簡單類型的屬性,可以如下定義:
class TSome { PRotected: int a; int b; int s; int GetSum(void){ return s = a + b ; } void SetSum(int s){ this->s = s ; } public: //...其它代碼 __property int sum={read=GetSum,write=SetSum}; //...