I happen to see a code something like this.
function((dynamic) param1, param2);
When and why do we need this kind of dynamic type casting for parameters?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It can be used to dynamically choose an overload of
function(...)based on the type ofparam1at runtime, for example:So even though
xis a reference toobject, it will decide at runtime what overload ofSomething()to call. Note that if there is no appropriate overload, an exception will be thrown: