Access to ambiguous class member
<p>Ive got a diamond. I want to access class member. I am using mingw.<br>
<strong>Question is</strong>: <strong>How to access member "top::A"</strong> without redeclaring classes</p>

<pre><code>#include &lt;cstdio&gt;
class top {
public:
    const char A;
    top(): A('t') {}
};
class left: public top {
public:
    const char A;
    left():A('l'){}
};
class right: public top {};
class bottom: public left, public right {};

int main() {
    bottom obj;
    printf("%c\n", obj.bottom::right::A); //using right::A, inherited from top::A
    printf("%c\n", obj.bottom::left::A); //using left::A and left::top::A is hidden
    //printf("%c\n", obj.bottom::left::top::A); //error. How to access it?
    return 0;
}
</code></pre>

<p>When I remove comment mingw gives me an error:  </p>

<pre><code>'top' is an ambiguous base of 'bottom'  
</code></pre>

<p>Update: Looks like casting types works:</p>

<pre><code>printf("%c\n", static_cast&lt;top&gt;(static_cast&lt;left&gt;(obj)).A);
printf("%c\n", static_cast&lt;left&gt;(obj).::top::A);
printf("%c\n", reinterpret_cast&lt;top&amp;&gt;(obj).A);//considered bad
printf("%c\n", (reinterpret_cast&lt;top*&gt;(&amp;obj))-&gt;A);//considered evil
//      printf("%c\n", static_cast&lt;top&amp;&gt;(obj).A);//error
</code></pre>
