answersLogoWhite

0

What is static type checking?

Updated: 11/3/2022
User Avatar

Wiki User

6y ago

Best Answer

Static type checking is type checking that can be done at compile time at no runtime cost, as opposed to dynamic type checking which can only be done at runtime. Dynamic type checking is most commonly utilised when you hold a pointer to a base class of a polymorphic type, but where you need to know the actual type at runtime. However, dynamic type checking can largely be avoided by utilising virtual functions to implement a common interface. In this way, you get the correct behaviour without needing to know the actual type. Although virtual functions come with a (small) cost in terms of memory consumption and performance, the cost is trivial compared to dynamic type checking.

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is static type checking?
Write your answer...
Submit
Still have questions?
magnify glass
imp