Getting Started with Adobe After Effects - Part 6: Motion Blur
This module helps you to share, discuss and learn interview questions and answers of different technologies

Method overloading is possible with different return type?

Feb 22 2012 12:00AM by Kirti M.Darji   

Question

Can we declare 2 methods with same parameters and different return types?

Answer

No,it is not possible, It give error like “method Add is defined with same parameter types”. You can try with below code.

public int Add(int Number1, int Number2)
    {
        return (Number1 + Number2);
    }


public float Add(int Number1, int Number2)
    {
        return (Number1 + Number2);
    }

Method overloading method have same name but their parameter list should be different in term of parameters or their data type. So if Method return type different then it not call method overloading.

Read More..   [200 clicks]

Published under: C# Interview Questions and Answers ·  ·  ·  · 


Kirti M.Darji
10 · 16% · 4985
0
Liked
 
0
Asked



Submit

Your Comment


Sign Up or Login to post a comment.

"Method overloading is possible with different return type? " rated 5 out of 5 by 3 readers
Method overloading is possible with different return type? , 5.0 out of 5 based on 3 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]