Wednesday, 24 December 2014

Signature vs Return Type

hey...............
Why we can't have different signature with different return type ?
look ...........
class A
       {
              public:
                    int name1 (int , int);
                    float name1(int, int, int);
                    char name1(int , int);
        }
int main()
   {
            cout<<"Coming to calll ";  
            int a;
            a = name1(5,6);        //////oops cause compiler error;
    };
int A::name1(int ,int)
   {
                  --------
   }
float A::name1(int ,int, int)
   {
                  --------
   }
char A::name1(int ,int)
   {
                  --------
   }


so we got compilation error when we different signature with different return type but WHY?????????
coz....... compiler unable to find the return type of called function ...........





No comments:

Post a Comment