Static type checking means that type checking occurs at compile time. No type information is used at runtime in that case.
Dynamic type checking occurs when type information is used at runtime. C++ uses a mechanism called RTTI (runtime type information) to implement this. The most common example where RTTI is used is the dynamic_cast operator which allows downcasting of polymorphic types:
// assuming that Circle derives from Shape... Shape *shape = new Circle(50); Circle *circle = dynamic_cast<Circle*> shape;
Furthermore, you can use the typeid operator to find out about the runtime type of objects. For example, you can use it to check whether the shape in the example is a circle or a rectangle. Here is some further information.
Related Posts:
- What is a segmentation fault?
- Sleep for milliseconds
- C++ Cout & Cin & System “Ambiguous” [closed]
- Floating point exception( core dump
- Passing Arrays to Function in C++
- Split a string using C++11
- error: expected unqualified-id error: Meaning and fix? [duplicate]
- How to track down a “double free or corruption” error
- undefined reference to `WinMain@16′
- How can I clear console
- How to go from fopen to fopen_s
- How does the modulus operator work?
- Single class has a Class Redefinition Error
- Identifier not found error on function call
- Debug assertion failed. C++ vector subscript out of range
- What causes a SIGABRT fault?
- How to get current time and date in C++?
- where is the official c++ documentation
- wntdll.pdb not loaded – Can’t see the exception
- Networking with C++
- Error a function-definition is not allowed here before ‘{‘ token
- invalid new-expression of abstract class type error
- How can I create objects while adding them into a vector?
- what does “error : a nonstatic member reference must be relative to a specific object” mean?
- “Symbol(s) not found for architecture x86_64” on QtCreator project
- Socket Programming in C++
- Is “argv[0] = name-of-executable” an accepted standard or just a common convention?
- How to fix ‘std::logic_error’ what(): basic_string::_M_construct null not valid error?
- What does the assignment of ~0u to a variable mean in C++?
- expected expression in C++?
- How to access the contents of a vector from a pointer to the vector in C++?
- printf with std::string?
- “Error: expression must have a pointer type” when using the “this” keyword
- C++ #include guards
- glm rotate usage in Opengl
- General way of solving Error: Stack around the variable ‘x’ was corrupted
- error MSB3073: How do I fix this?
- timestamp of time(0) at multiple places in a C++ program
- What’s the most efficient way to erase duplicates and sort a vector?
- How can I iterate through a string and also know the index (current position)?
- c++ parse int from string [duplicate]
- C++ array assign error: invalid array assignment
- Is there a median function in the C++ library?
- Determine if map contains a value for a key?
- error: member access into incomplete type : forward declaration of
- Debug assertion failed
- “Implicit instantiation of undefined template” when forward declaring template class
- “…redeclared as different kind of symbol”?
- how to initialize an empty integer array in c++
- What does |= mean in c++
- Error: cannot declare variable ‘c’ to be of abstract type ‘circle’
- Static linking vs dynamic linking
- What is object slicing?
- Java equivalent of cin (C++)
- g++ “because the following virtual functions are pure” with abstract base class
- why can’t I dereference an iterator?
- expected identifier before string constant
- C++ error: expected identifier before “(” token
- Function for C++ struct
- C++ error: double free or corruption (fasttop)
- no match for ‘operator<<’ in ‘std::operator
- android,
android-layout,
android-linearlayout,
gradient, - Reading multiple lines from a file using getline()
- Is there a standard C++ grammar?
- invalid use of non-static data member
- How does c++ represent negative value
- error: switch quantity not an integer
- How to create a vector of class objects in C++?
- Is clrscr(); a function in C++?
- Cross compiler prefix and path in eclipse
- How to write log base(2) in c/c++
- Reading a string from file c++
- How to memset char array with null terminating character?
- Converting from Radians to Degrees
- The system cannot find the file specified. in Visual Studio
- Python for C++ Developers
- Remove last character from C++ string
- Use of undefined type [duplicate]
- Warning : overflow in implicit constant conversion
- C++ multiline string literal
- Getting a bunch of crosses initialization error
- c++ a heap has been corrupted error when running the program
- Expected unqualified-id before ‘[‘ token
- C++ Error: Invalid conversion from ‘char’ to ‘const char*’
- cc1.exe System Error – libwinpthread-1.dll missing – But it isn’t
- ‘setprecision’ is not a member of ‘std’
- How to use stringstream to separate comma separated strings [duplicate]
- When/why to make function private in class?
- Converting bool to text in C++
- clearing a vector of pointers [duplicate]
- Evaluate a string with a switch in C++ [duplicate]
- C++ JSON Serialization
- stack around the variable…was corrupted
- Creating a list to hold objects in C++
- What does “warning: not all control paths return a value” mean? (C++)
- Array of Linked Lists C++
- Is it still safe to delete nullptr in c++0x?
- Declaration is incompatible with type
- One or more multiply defined symbols found
- I’m getting the error “stoi is not a member of std” in myprogramminglab [duplicate]