Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Overloading and polymorphism - Are they same

This is a discussion on Overloading and polymorphism - Are they same within the C and C++ forums, part of the Programming Talk category; Hi All, Polymorphism is a certain item appearing in different forms or ways. That is making a function or operator ...

  1. #1
    Allan is offline Member Array
    Join Date
    May 2006
    Answers
    40

    Overloading and polymorphism - Are they same

    Hi All,
    Polymorphism is a certain item appearing in different forms or ways. That is making a function or operator to act in different forms. I wanted to know whether Overloading and polymorphism refer to same technology. If not what is the difference between the two?

    Regards,
    Allan


  2. #2
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    Overloading is a kind of Polymorphism. The first difference to state is in terms of syntax of appearance of overloaded functions and polymorphic functions. Overloaded functions have structure and calling method just like normal function calls. Polymorphic functions require the use of a dot operator.


  3. #3
    Manyamanas is offline Member Array
    Join Date
    Dec 2010
    Answers
    32
    no overloading and polymorphism is not a same thing.....
    overloading is a process of loading a function or operator in a method on the other hand polymorphism is a process of using a same function in different way. Return type and name of the function should be same////for example

    int add(int,float);
    int add(int,int);
    float add(int,int);

    first two will work as a polymorphism,because the return type and name is same...when we will enter int and float,1st function will be called and when we will enter two integer value 2nd function will be called..
    for third function new calling line got to declare in the main as because the return type is different...


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...