cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
returning managed variable
returning managed variable
Jun 14, 2012 at 11:04pm UTC
jorz
(55)
Hi All,
I would like to return a managed array from a class is this possible?
or what would be an other good solution or should I return a pointer to a managed array ?
Many thanks
Jun 15, 2012 at 12:21am UTC
Need4Sleep
(570)
could you show me an example? i dont quite know what you're trying to ask.
Jun 15, 2012 at 1:49am UTC
jorz
(55)
lets say I have a class with a method
class firstclass {
int x, y;
public:
void set_values (int,int);
{
array<array<int>^>^ arr = gcnew array<array<int>^> (5);
for(int i=0, j=10; i<5; i++, j+=10)
{
arr[i] = gcnew array<int> (j);
}
return arr;
}
};
I would like to receive arr into an other function/class
Jun 16, 2012 at 2:55am UTC
jorz
(55)
anyone ?
Jun 16, 2012 at 1:59pm UTC
closed account (
o3hC5Di1
)
Hi there,
As far as I know it's not possible to pass an array to a function as an argument.
Their are some workarounds though, one would be to wrap the array in an object and pass the object.
Maybe someone more experienced has a more elegant solution.
Hope that helps.
All the best,
NwN
Topic archived. No new replies allowed.