-3

I read many notes and online tutorials but I don't have clear idea what is the basic difference between method overriding and function overriding and function overloading and method overloading.

Priyantha
  • 4,839
  • 6
  • 26
  • 46
Malik Asad Ali
  • 113
  • 2
  • 10

3 Answers3

1

For fully object oriented programming, I mean the languages like C# or Java there are only methods, there is no function.

For fully scripting langauges like C there is no method, there are functions.

For mixed languages like C++, perl, python, php there are both. When code will beused as script then they'll call function, when code will be used as class then they will call method.

Please check http://study.com/academy/lesson/oop-object-oriented-programming-objects-classes-interfaces.html for more detail definition.

Md. Mehedi Hasan
  • 196
  • 2
  • 14
0

Simple explanation.

Method overloading is having two or more methods with the same name with a different number and/or different type of parameters.

eg:

public void AddDog(string type){} 
public void AddDog(string type, string color){}

Method overriding allows a class to alter an inherited classes method.

eg:

 public class Dog
    {
        public virtual void Bark()
        {
            Console.WriteLine("Roff");
        }
    }

  public class Wolf:Dog
    {
        public override void Bark()
        {
            Console.WriteLine("Grrr");
        }
    }
Xela
  • 2,322
  • 1
  • 17
  • 32
-1

The only difference is whether or not a method or a function is being overridden/overloaded. See Difference between a method and a function

identicon
  • 967
  • 10
  • 20