【发布时间】:2012-12-03 12:31:59
【问题描述】:
我正在尝试使用重载运算符,但不确定如何在我的主 cpp 中使用/调用它。代码在另一个文件中,如下所示:
string postH::operator[](int add){
if(add > 100)
{return "\nsome text\n";}
else {return "\nsome other text\n";}
}
【问题讨论】:
-
这让我想知道你为什么要超载它......
标签: c++ overloading operator-keyword