C# Method Overloading- in few simple steps with example

So, till this moment you saw some common scenarios about OOPs and its related concepts. Basically the premier use of OOPs programming methodology is to employ Resuability,
               Allow to focus on data, 
               Protability etc.

So friends, lets move further and do take a look on overloading of methods in C#.

It would not be much difficult as we have already assumed.

Straightforwardly,  few things about overloading.
-> When there are two or more than two methods, and with same name but different signature are available - known as method overloading.
-> These function could have same return type or different does not create any difference for overloading. 
                  public void demoOverload(int y){}      
        public int demoOverload(int y, int z){}

-> Main thing which we should concentrate about, is how we define different number of parameter for a method which share same name for all available methods.
                  public void demoOverload(int y){}     
        public void demoOverload(double y){}  
        public void demoOverload(string val){}
                  public double demoOverload(double y, double z){}

-> Now, when ever you want to make a call to your desired method just create an object of that class and then call the method name 
with the appropriate parameters input.
        object.demoOverload("hello world");              

Hope this demonstration will help you in understanding the method overloading concept in easy steps.



* You all are welcome to express your views as comment in the box given below of this post. 

* I have not made any special conditions to write here your comment but you may write whatever your heart speak out loud in your inner-self.

* This blog space is continuously in writing/edit mode, kindly keep visiting for a full version]

Post related to CSharp programming

No comments:

Post a Comment

Search This Blog

Let make your friend aware about this post