String pass by reference
-
ok i'm anoob in cli and i'm sure this quesiton has a simple answer ...but i'm new to managed code so... what i wanna do is:
void mod_str(String ^bb) {
bb="bau";
}
void action() {
String ^str="ciao";
mod_str(str);
this->button1->Text=str;
}what i wanna is that this button1 text became "bau" but with this code it remains "ciao"... in c++ it wolud be something like...
void mod_str(string &str) {
str="bau";
}void action() {
string str="ciao";
mod_str(str);
....
} -
ok i'm anoob in cli and i'm sure this quesiton has a simple answer ...but i'm new to managed code so... what i wanna do is:
void mod_str(String ^bb) {
bb="bau";
}
void action() {
String ^str="ciao";
mod_str(str);
this->button1->Text=str;
}what i wanna is that this button1 text became "bau" but with this code it remains "ciao"... in c++ it wolud be something like...
void mod_str(string &str) {
str="bau";
}void action() {
string str="ciao";
mod_str(str);
....
}instead of
void mod_str(String ^bb) {
bb="bau";
}use
void mod_str(String ^%bb) {
bb="bau";
}EDIT: This is a pretty good place to learn the keywords and operators specific to C++/CLI http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^]
Don't be overcome by evil, but overcome evil with good
-
instead of
void mod_str(String ^bb) {
bb="bau";
}use
void mod_str(String ^%bb) {
bb="bau";
}EDIT: This is a pretty good place to learn the keywords and operators specific to C++/CLI http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^]
Don't be overcome by evil, but overcome evil with good
Thank you for this simple but important reply