Showing posts with label overloading. Show all posts
Showing posts with label overloading. Show all posts

Tuesday, August 7, 2012

does method signature include return type in C sharp (c#)

does method signature include return type in C sharp (c#)

I would say  BIG  NO


I read a lot of blogs and finally i have decieded to test by self and i just make some simple code

protected int sum(int a, int b)
    {
        return a + b;
    }

    protected float sum(int a, int b)
    {
        return a + b;
    }


when i run this its throws error

already defines a member called 'sum' with the same parameter types

but if i change the parameter type then its runs OK

so final result is method signature not  include return type. and a method can be not overloaded just by changing its return type .



.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...