Difference between dynamic and static casting

What is the difference between dynamic and static casting?

static_cast are used in two cases :

1) for implicit casts that the compiler would make automatically anyway (bool to int)
2) as a mandatory forced cast (float to int).

- The dynamic_cast is unique to C++. It is used at runtime when info is required to make the proper cast.
- For example, when you downcast a base class pointer to a derived class.
Describe static and dynamic binding of functions - C++
Describe static and dynamic binding of functions - By default, matching of function call with the correct function definition happens at compile time......
What are pure virtual functions?
What are pure virtual functions? - Pure virtual functions are also called ‘do nothing functions’...
What is a namespace? What happens when two namespaces having the same name?
What is a namespace? - A conceptual space for grouping identifiers, classes etc. for the purpose of avoiding conflicts....
Post your comment