msdn中c#的例子:
int MyInt = 12;
string MyString = String.Format("Your dog has {0} fleas. It is time to get a flea collar. The current universal date is: {1:u}." , MyInt, DateTime.Now);
在c++中改为:
int MyInt = 12;
String* MyString = String::Format("Your dog has {0} fleas. It is time to get a flea collar. The current universal date is: {1:u}." , &MyInt, DateTime::Now);
编译不通过,提示:
none of 5 overloads can convert parameter 2 from type int*
何故?
怎样改?
try
Int32 MyInt = 12;
String* MyString = String::Format("Your dog has {0} fleas. It is time to get a flea collar. The current universal date is: {1:u}.", __box(MyInt),__box(DateTime::Now));