Created
March 30, 2015 07:15
-
-
Save zma/c3307cc5dce0684fe220 to your computer and use it in GitHub Desktop.
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 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