Okay I think I figure it out now... It was my bad for not fully understanding the specifications of the practice project (and not noticing it). The specs were very long, so I didn't include all of them in my question, which also led to further confusions.
For whatever it's worth I'll try to document the cause of this mess:
What
send function defined in
xhost was expected to do was:
1. After doing stuff above the ///ERROR line, check whether the argument reference
other is bound to a
host or an
xhost.
2. If
other is bound to an
xhost : call
other(i.e. an xhost)'s member function handle_recv.
And if
other is bound to a
host :
DO NOTHING. (f%^&*%$$##@##$ me....)
So what Philippe Mori said was correct, but not really related to the mess here (which is 100% my bad. Sorry...). The "solution" could simply be replacing the ///ERROR line by something like:
if (typeid(other) == typeid(const xhost &))
dynamic_cast<const xhost="">(other).handle_recv(*this, message);