Method (computer Programming) - Overloaded Methods

Overloaded methods are those that appear to have the same name, but that have different formal parameter types (or result value type, if the language supports overloading on result type). The "real name" of the method is made up by concatenating the identifier used to name the method with an encoding of the types, so this works only for languages in which the types are statically known. Overloading is generally confusing; it is better practice to simply come up with more meaningful names for ones methods, that is, names that explain the role of the parameters. For example in the following C++, class geometry have two method named "area". But their parameter list is different which distinguish the methods. Many other languages provide this feature.

#include using namespace std; class geometry { public: static double area(double h,double w) { return h*w; } static double area(double r) { return r*r*3.14; } }; int main { double rectangle_area=geometry.area(3,4); double circle_area=geometry.area(5); cout<

Read more about this topic:  Method (computer Programming)

Other articles related to "overloaded methods, method, methods":

Method (computer Science) - Overloaded Methods
... Overloaded methods are those that appear to have the same name, but that have different formal parameter types (or result value type, if the language supports overloading on result type) ... The "real name" of the method is made up by concatenating the identifier used to name the method with an encoding of the types, so this works only for languages ... come up with more meaningful names for ones methods, that is, names that explain the role of the parameters ...

Famous quotes containing the words methods and/or overloaded:

    If you want to know the taste of a pear, you must change the pear by eating it yourself.... If you want to know the theory and methods of revolution, you must take part in revolution. All genuine knowledge originates in direct experience.
    Mao Zedong (1893–1976)

    “Play,” the useless, as the ideal of one who is overloaded with strength, as “childlike.” The “childlikeness” of god, pais paizon.
    Friedrich Nietzsche (1844–1900)