有没有办法在 C++ 中扩展数据类型,就像在 JavaScript 中一样?
我想这有点像这样:
char data[]="hello there";
char& capitalize(char&)
{
//Capitalize the first letter. I know that there
//is another way such as a for loop and subtract
//whatever to change the keycode but I specifically
//don't want to do it that way. I want there
//to be a method like appearance.
}
printf("%s", data.capitalize());
这应该以某种方式打印。