GeekInterview.com
Series: Subject: Topic:
Question: 14 of 85

Compile Time Overloading

What is the requirement of compile time overloading?
Asked by: hellzangel_11 | Member Since Aug-2010 | Asked on: Aug 14th, 2010

View all questions by hellzangel_11

Showing Answers 1 - 2 of 2 Answers
pvernekar

Answered On : Nov 14th, 2010

View all answers by pvernekar

Method with the same name, same or different return type and difference in the parameters either in number or type

  
Login to rate this answer.
Praveen

Answered On : Jan 16th, 2012

We know that because of polymorphism, we can declare any number of function with change in signature.

Signature considers three parts
1. No.of parameters
2. Type of parameters
3. Order of parameters

The function which we are calling in our code is known to compiler at the time of compilation itself. This is called compile time polymorphism.

For example,

Let the functions are as follows,
Sum(int a, int b) { ------}
Sum(float a, int b) { ------}
Sum(int a, float b) { ------}
Sum(float a, float b) { ------}

In our code if we use sum(2,3) then at compilation time itself the compiler know that the function is Sum(int a, int b). This is called Compile time polymorphism.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.