Skip to content

Instantly share code, notes, and snippets.

Last active June 23, 2016 04:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
sparse materials, for curious ppl and interview seekers

#how do we know object type in runtime :? that could be if: the language support RTTI

##type introspection figuring the metadata at runtime

##C++ specific ###dynamic_cast way: Dynamic cast an object to a class, do we get a bad_cast exception, then it's not the right type
be cautious base class must have at least one virtual method!! ###type_id way:

#include <typeinfo>
string s = typeid(YourClass).name()

##type reflection manipulating the metadata at runtime

the word binding!

types, functions and values determination at run/compile time (dynamic loading, dispatching and binding)

the four types of polymors

Subtype polymorphism (runtime polymorphism).
Parametric polymorphism (compile-time polymorphism).
Ad-hoc polymorphism (overloading).
Coercion (implicit or explicit casting).

scope resolution operator ::

use to force traversing from the global namespace downword while figuring out which class to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment