Object

What does object.method1().method2() mean?
Invoke method2 on the object returned by object.method1.
closed account (z05DSL3A)
It is called method chaining:
http://www.parashift.com/c++-faq/method-chaining.html
The object must have a type, say T.
Each function has a type too; parameter types and return type.

Type T apparently has a member function T::method1(). No parameters, but some return type. Say U. U T::method1(), or in C++11 syntax auto T::method1() -> U.

Type U apparently has member function U::method2(). The call to T::method1() returns an unnamed temporary object of type U, so it is possible to call a member of that object.


If you have seen the code with that expression, then you should have access to the type definitions as well, and could backtrack every type.
Topic archived. No new replies allowed.