Wednesday, 6 August 2014

Why does the function arguments are called as "signatures"?


The arguments distinguish functions with the same name (functional polymorphism). The name alone does not necessarily identify a unique function.  However, the name and its arguments (signatures) will uniquely identify a function.
            In real life we see suppose, in class there are two guys with same name, but they can be     easily identified by their signatures. The same concept is applied here.
            ex:
                        class person
                        {
                  public:
                                    char getsex();
                                    void setsex(char);
                                    void setsex(int);
                        };

            In the above example we see that there is a function setsex() with same name but with different signature.

No comments:

Post a Comment