在 c++11里面这倆已经变得一样了. 不过我不是很理解这个函数在除了这个稍显鸡肋情况下还有哪里可以用到.
string s = "Hello, world!";
printf("%s", s.c_str());
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这两个成员函数就是为了兼容
C接口而设计的。