Next, consider this code. It does the same thing, except the io_service class is now a member of Client as opposed to a reference to some super-instance.
I can't explain it, but when I try to compile the latter I get:
[stew@Romulus test]$ make client
g++ -o client client.cpp -L/usr/lib -lboost_system -lpthread
client.cpp: In function ‘int main()’:
client.cpp:25:11: error: request for member ‘send’ in ‘client’, which is of non-class type ‘Client()’
client.send("hello world\n");
^~~~
client.cpp:26:11: error: request for member ‘send’ in ‘client’, which is of non-class type ‘Client()’
client.send("bye world\n");
^~~~
make: *** [makefile:8: client] Error 1
Can someone help me to understand the error? Why is the send method suddenly treated as if it wasn't a member? If I make Client a class and put everything in public: I get the same thing.