1.

What do you understand by function overloading or functional polymorphism? Explain with suitable example.

Answer»

Function Overloading or Functional Polymorphism: 

It is a method of using the same function or method to work using different sets of input. Function overloading is one of the example of polymorphism, where more than one function carring same name behave differently with different set of parameters passed to them. 

Example

int area(int length, int breadth) 

return(length*breadth);

}

float area(int base, float height) 

return(base*height/2); 

}



Discussion

No Comment Found

Related InterviewSolutions