i have doubt i don’t know what is compile time and what is runtime in C#. i get this words from polymorphism (Method overloading, method overriding) can u explain me. Thank you
Share
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.
Method overloading is determined at compile time. That means that the compiler knows exactly which code will be executed when you call an overloaded method. It can produce a direct call to the code without adding any checks that would have to be done when the code runs.
Method overriding is determined at runtime. When you call a virtual method the actual method to call is determined from the actual type of the object, and this check has to be done when the call is done. As a reference can potentially reference objects of different types, the compiler can’t determine from the reference type which method will be called, so it has to add code for looking up which class to get the method from.