understanding c++ pointers to parent/base classes
<p>I was asked this interview question and I got it wrong. "What is the output": My answer was 135, the actual output is 136. This implies that the pointer's to the two parent classes are not equal even though they pass the prior test of being equal to the child class.
I thought I understood c++ pointers, but this has me stumped for an explanation. Although I think I see what's going on, I'm not sure why. Any c++ experts out there that can offer a technical explanation?
It appears the first two comparisons are more logical in nature, while the last comparison is more literal...</p>

<pre><code>#include &lt;iostream&gt;

class A
{
    public:
    A() : m_i(0) { }

    protected:
    int m_i;
};

class B
{
    public:
    B() : m_d(0.0) { }

    protected:
    double m_d;
};

class C
    : public A, public B
{
    public:
    C() : m_c('a') { }

    private:
    char m_c;
};

int main()
{
    C c;
    A *pa = &amp;c;
    B *pb = &amp;c;

    const int x = (pa == &amp;c) ? 1 : 2;
    const int y = (pb == &amp;c) ? 3 : 4;
    const int z = (reinterpret_cast&lt;char*&gt;(pa) == reinterpret_cast&lt;char*&gt;(pb)) ? 5 : 6;

    std::cout &lt;&lt; x &lt;&lt; y &lt;&lt; z &lt;&lt; std::endl;
    return 0;
}
</code></pre>