Overloading and Overriding

Total Post:7


 550  View(s)
Rate this:

What is the difference between overloading and overriding

in Python or Java ?

  1. Re: Overloading and Overriding

    Hi Additri,

    In Oop's(Object oriented programming) concept, Polymorphism is the characteristic of being able assign a different to a particular symbol means many shapes. 

    polymorphism are two types:

    Overloading :

    Two or more method with different signatures.lets perform a arithmetic addition of two numbers,the feature in python that allow some operator to have different  meaning according to the context is called operator overloading.

    Ex: "CUT" are three type of meanings for Surgeon,Hair stylist and Actor. 

    Pseudo code in java:

       void draw(int x1, int y1, int x2, int y2) {
       void draw(float x1, float y1, float x2, float y2) { 

    Overriding :

    Replacing an inherited method with another having the same signature. or two or more methods having the same name with same argument in parents class and child class in java.

    Pseudo code in java:

     class Company 
    public void rule() {
    System.out.println("company having rules");
    class employee extends company
    public void rule()
    System.out.println("amployee must follow rules"); }
    public void work() {
    System.out.println("employee work for company"); }
    public class TestEmployee {
    public static void main(String args[]) {
    Company = new Company();

    Happy Coding :)


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.