Tuesday, January 03, 2012

What is the Difference between Overriding and overloading?

Posted by Rahul Kharde at 12:58 AM
Overloading is defining functions that have similar signatures, yet have different parameters. 

Overriding is only pertinent to derived classes, where the parent class has defined a method and the derived class wishes to override that function.

Methods name and signatures must be same.
Having same method name with different
Overriding is the concept of runtime polymorphism
Overloading is the concept of compile time polymorphism
When a function of base class is re-defined in the derived class called as Overriding
Two functions having same name and return type, but with different type and/or number of arguments is called as Overloading
It needs inheritance.
It doesn't need inheritance.
Method should have same data type.
Method can have different data types
Method should be public.
Method can be different access specifies



public class MyBaseClass
    public virtual void MyMethod()
        Console.Write("My BaseClass Method");

public class MyDerivedClass : MyBaseClass
    public override void MyMethod()
        Console.Write("My DerivedClass Method");



int add(int a, int b)
int add(float a , float b)

If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!

Kindly Bookmark and Share it:



Nanil on February 6, 2013 at 7:53 PM said...

thank you sir. its enough to understand

Anonymous said...

nice and simple article thanks

mohit sharma on March 22, 2013 at 4:33 AM said...

thanks for helping me to clear this topic..

raghu said...

nice article

lingmaaki on January 18, 2015 at 11:44 PM said...

Check this one.....Difference between method overloading and method overriding


ajmath shaik on March 27, 2015 at 2:05 AM said...

Excellent explanation Difference Between Method Overloading and Method Overriding

satish dixit on November 1, 2015 at 3:28 AM said...
This comment has been removed by the author.

satish dixit on November 1, 2015 at 3:29 AM said...

nice post .refer simillar post What is Function Overriding and Function Overloading in Java

Hitesh Kumar on July 14, 2016 at 1:32 AM said...

Difference Between Overloading and Overriding in Java

Nice Article Thanks for sharing this post

Dipendra Karki on July 23, 2016 at 8:46 AM said...

thank you for this answer

Dhanraj Sakariya on August 18, 2016 at 5:08 AM said...

sorry sir, but i need more difference. means more line.

J.Nageswara Rao on September 27, 2016 at 6:46 AM said...

ok so nice
please provide additional information about c++

Geetha Devi on January 28, 2017 at 2:14 AM said...

Thanks for sharing overriding and overloading concepts in java..java training in chennai

Mithun Mithun on July 6, 2017 at 12:14 AM said...

Thanks for your informative articel .its very useful
dot net training in velachery | dot net training in chennai

Pavithra M on July 6, 2017 at 12:30 AM said...

It is really a great work and the way in which u r sharing the knowledge is excellent.
Thanks for helping me to understand basic concepts. As a beginner in dot net programming your post help me a lot.Thanks for your informative article.Dot Net training in chennai | Dot Net training institutes in chennai | Dot Net training in velachery

Tanika Co Valda on October 31, 2017 at 9:32 AM said...

This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Dot Net Training in Chennai. or learn thru ASP.NET Online Training . Nowadays Dot Net has tons of job opportunities on various vertical industry.

Narmadha Raj on June 16, 2018 at 12:52 AM said...

Great post, Thanks for sharing with us, This is very helpful for me.

Web Designing Training in Chennai

Have any question? Feel Free To Post Below:


Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top