+ 4
Difference between overloading and overriding
Overloading and overriding
6 Respostas
0
Overloading is in a class
Where override is in two different class
+ 4
These concepts may also be defined in the tutorials.
+ 3
What language do you use ?
I use c#.
Overloading :
Being able to call a method with the same name with different parameters
https://code.sololearn.com/cmWLZrb9Tddw/#cs
Overriding :
Change the behaviour of a method in the base-class in a derived class
https://code.sololearn.com/c7P1Q7lSmIWU/#cs
+ 3
HABIB KHAN please don't spam.
+ 1
Hello,
There are many differences between overloading and overriding. But the main difference is between these is for overloading you require one class while for overriding you require two classes. Following is the simple example of overloading and overriding.
class OverloadingExample
{
static int add(int a,int b){return a+b;}
static int add(int a,int b,int c){return a+b+c;}
}
class Animal
{
void eat()
{
System.out.println("eating...");
}
}
class Dog extends Animal
{
void eat()
{
System.out.println("eating bread...");
}
}