4
方法链中的C ++执行顺序
该程序的输出: #include <iostream> class c1 { public: c1& meth1(int* ar) { std::cout << "method 1" << std::endl; *ar = 1; return *this; } void meth2(int ar) { std::cout << "method 2:"<< ar << std::endl; } }; int main() { c1 c; int nu = 0; c.meth1(&nu).meth2(nu); } 是: method 1 …