Can someone explain what's happening here (classes and constructors/destructors)?
<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

class Person
{
    string name;

    public:
        Person():name("")
        {
            cout &lt;&lt; "Person default ctor\n";
        }
        Person(const string&amp; name_in):name(name_in)
        {
            cout &lt;&lt; "Person string ctor: " &lt;&lt; name &lt;&lt; "\n";
        }
        ~Person()
        {
            cout &lt;&lt; "Person dtor: " &lt;&lt; name &lt;&lt; "\n";
        }
        string get_name()
        {
            return name;
        }
};

class Professor:public Person
{
    int office;

    public:
        Professor(const string&amp; name_in, int office_in):Person(name_in), office(office_in)
        {
            cout &lt;&lt; "Professor string ctor: " &lt;&lt; get_name() &lt;&lt; endl;
        }
        ~Professor()
        {
            cout &lt;&lt; "Professor dtro: " &lt;&lt; get_name() &lt;&lt; endl;
        }
};

int main()
{
    Person alice("Alice");
    Professor bob("Bob", 10);

    return 0;
}
</code></pre>

<p>I would assume that the output should be:</p>

<pre><code>Person string ctor: Alice

Person dtor: Alice

Professor string ctor: Bob

Professor dtor: Bob
</code></pre>

<p>Since it seems like that should logically follow from the structure of the program.  However, the real output is:</p>

<pre><code>Person string ctor: Alice

Person string ctor: Bob

Professor string ctor: Bob

Professor dtor: Bob

Person dtor: Bob

Person dtor: Alice
</code></pre>

<p>Can someone explain why this is?  What am I not understanding about classes/constructors/destructors that's making me come up with the wrong output?</p>
