Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

very interesting thing

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
I've found a very interesting thing in Microsoft C++:

#include<iosrteam>
using namespace std;
class x
{
int xx;
int yy[10];
public:
__declspec(property(get=getA,put=setA)) int A;
__declspec(property(get=getB,put=setB)) int B[];
x():xx(0){}
int getB(long i){return yy;}
void setB(long i,int j){yy=j;}
int getA(){return xx;}
void setA(int _xx){xx=_xx;}
};
int main()
{
x t;
t.A=10;
cout<<t.A<<endl;
for(int i=0;i<10;i++)
{
t.B=i;
cout<<t.B<<endl;
}
return 0;
}

Look at the __declspecs
I think is a very nice and useful feature of MicrosoftC++. It is introduced first time in VisualC++5. John Fill
1c.bmp


ivfmd@mail.md
 
Yes, very interesting. Looks like PropertySet, Property Get from VB.I wonder if I can put some &quot;inline&quot; in the code above, as I usually do with the getters.

NB: Though, this feature is Microsoft Specific. Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Yes it is Microsoft specific. Would bi nice if it was not only MS specific. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top