Created
March 30, 2015 07:16
-
-
Save zma/0921407d33d0104f6e08 to your computer and use it in GitHub Desktop.
ambiguous-casting.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { }; | |
class B { }; | |
class C: public A { }; | |
class D: private C, public A, public B { }; | |
int main () | |
{ | |
D *d = new D; | |
A *a1 = dynamic_cast<A *>(d); | |
A *a2 = static_cast<A *>(d); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment