Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

2 returns giving another methode

Name: Anonymous 2011-05-30 7:25

i want to do that

        String^ error() {
            String ^x= "penis";
            String ^y= "wurst";
        return x,y;
        }
and then
 MessageBox::Show(error()) its work but it just shows wurst the place for penis is empty

Name: Anonymous 2011-05-30 7:36

You can't return two values in C++/CLI.

return x,y; returns y, the comma here is the so-called "comma operator", primarily used in for loops (to do "for (i = 0, j = len; i < j; i++, j--)" and such). It returns the second argument.

Doesn't the fact that your function is declared as returning String^, not the pair of strings, make you think?

If you want to return a single string, but composed of two strings, do just that, return x + " " + y.

Also, please use code tags.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List