views:

43

answers:

1

Hello,

As a C++ programmer I've recently started to work with visual c++. I've get stuck with the properties.

The idea is to create an inner class that would have 2 methods plus property like get/set functions. Does it even possible in visual C++ (i guess yes).

The usage would be like this:

Foo ^ foo = gcnew Foo();
int a;
foo->Method(); // here some function is called
a = foo; // here the property like get() function is called. 

I've even tried to do this with operator overload, but it seems that it is much more complicated in visual c++, than in "normal" c++.

MJ

A: 

This is not 'normal c++' it is native access to the .net Runtime - managed c++ (the gcnew gives this away). Do you need normal c++ on windows using visual c++ or managed c++?

If the earlier then normal c++ should work. If you need managed code - do you really need c++?

My managed c++ is poor but I think you'd need to declare get_XXX() and set_XXX() methods for this to work.

Preet Sangha
Sorry for being not precise. Of course by saying normal c++ i meant unmanaged C++ code.Unfortunately I must use visual C++, otherwise I have already done it ;)
Visual C++ is both - so you really mean managed right? Sorry but I'm still confused.
Preet Sangha