#include <iostream>
#include <conio.h>
using namespace std;
class Test
{
public:
Test() { m_int = 0; }
~Test(){};
protected:
private:
int m_int;
public:
Test& get();
Test& move();
Test& display() const;
};
Test& Test::display() const
{
cout<<"display m_int"<<m_int<<endl;
}
inline Test& Test::move()
{
m_int++;
return *this;
}
inline Test& Test::get()
{
cout<<m_int<<endl;
return *this;
}
int main()
{
Test t1;
t1.move().get();//1
t1.move().get().display();//2 2
t1.display().get();// 出现乱码 display()是const成员函数
t1.get();// 2
getch();
return 0;
}