【发布时间】:2011-08-16 04:17:52
【问题描述】:
Damage 和 Cost 是整数,但正如您在下面的代码中看到的,我想将它们与字符串连接起来(如果这是正确的词)。我怎样才能做到这一点?
class Weapon : Shopable{
private:
int Damage;
public:
std::string getDesc() const{
return getName()+"\t"+Damage+"\t"+Cost;
}
};
【问题讨论】:
标签: c++ string integer concatenation