How can you put a function inside a function like that
It's not entirely clear what you are asking.
If you're wondering how the two functions are declared so that
they can be invoked in a compact statement (concatenated), the
answer is that there is nothing special that needs to be done.
Using the dot operator allows using am implicit temporary
object so that you don't have to declare an explicit object.
For example:
class MyClass {
string s;
public:
string SetString(string str)
{
s = str;
return s;
}
};
MyClass c1;
// using explicit variables:
string temp = c1.SetString("12345");
int n = temp.size();
cout << n << endl;
// using implicit variables:
cout << c1.SetString("XYZ").size() << endl;
SetString returns a string and that string can be an
anonymous implicit object, the members of which can
be accessed using the dot operator.
- Wayne