#include <iostream>
using namespace std;
class A {
public:
A(string msg) : m_msg(msg)
{
cout << "A constructor:" << msg << endl;
}
virtual ~A()
{
cout << "A destructor" << endl;
}
void operator() (string msg)
{
if (m_msg.compare(msg) == 0) {
cout << "same msg" << endl;
} else {
cout << "different msg" << endl;
}
return;
}
private:
string m_msg;
};
int main(int argc, char **argv)
{
A a("Hello");
a("hello");
return 0;
}
09-05
1138
02-16
456
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交