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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is it interesting? 2

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
 
Nice. I had no idea they were there. I guess they won't help you any in MFC or ATL?

Chip H.
 
It especially for ATL and makes core more readable. But can be used anywhere in MicrisoftC++. John Fill
1c.bmp


ivfmd@mail.md
 
It's nice :)
But may be using such approach code will be less readable.
Best regards,
zaki-maksyutov@yandex.ru
 
No, as I tried, is very readable. It would be nice other compillers to support it. By the way, is much more readable than macrosses and templates. John Fill
1c.bmp


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

Part and Inventory Search

Sponsor

Back
Top