Value semantics.
When you do this;
slst.push_back(s);
you're creating a copy of
s
using the
copy-constructor[
^] (one will be generated for you even if you don't add one. And that copy, will have no items in the list as you're never adding anything to the copy's list.
If you add a constructor to
Supervisor
:
Supervisor(const Supervisor& other)
{
cout << "Supervisor::Supervisor(COPY_CONSTUCTOR)" << endl;
}
you can see it being called.
Hope this helps,
Fredrik