How exactly c++ vtable works? (with example in the q.) : <p>lets take an c++ example:</p>

<pre><code>class A
{
public:
    A() { cout &lt;&lt; "hey" &lt;&lt; endl; }
    ~A() { cout &lt;&lt; "by" &lt;&lt; endl; }


};


class B : public A
{
public:
    B() {}
    virtual ~B() { cout &lt;&lt; "from b" &lt;&lt; endl; }

};
int main()
{
    A * a = new B[5];



    delete[] a;

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

<p>the results of this code is an infinite loop of "by" , why is this? 
B vtable supposed to be upcast to A that don't have vtable , so i would expected it to throw an exception when he  try to reach the virtual constructor.</p>

<p>p.s. 
where i can read on all kind of examples of wired constructor destructor behave? (with examples ) </p>
