全部博文(94)
分类: C/C++
2012-09-05 20:00:55
class ClxTest { public: void Output() const; }; void ClxTest::Output() const { cout << "Output for test!" << endl; } void OutputTest(const ClxTest& lx) { lx.Output(); } |
class ClxTest { public: ClxTest(); ~ClxTest(); void Output() const; int GetOutputTimes() const; private: mutable int m_iTimes; }; ClxTest::ClxTest() { m_iTimes = 0; } ClxTest::~ClxTest() {} void ClxTest::Output() const { cout << "Output for test!" << endl; m_iTimes++; } int ClxTest::GetOutputTimes() const { return m_iTimes; } void OutputTest(const ClxTest& lx) { cout << lx.GetOutputTimes() << endl; lx.Output(); cout << lx.GetOutputTimes() << endl; } |
点击(此处)折叠或打开
点击(此处)折叠或打开