In e.g. jQuery you can encapsulate functions to execute many actions on an object in one line.
$('div').parent().find('a').is('.class').css('color', 'red');
I don’t know how how that work internally. How can I write a class in C++ with a similar behavior?
This is called method chaining and you can achieve the same effect in C++, depending on your return type.
This is just a simple example.