Skip to content

Instantly share code, notes, and snippets.

@zma
Created March 30, 2015 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zma/c3307cc5dce0684fe220 to your computer and use it in GitHub Desktop.
Save zma/c3307cc5dce0684fe220 to your computer and use it in GitHub Desktop.
casting.cc
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