what is the term genericity in oops?
Answer / akshata
Abstraction of structure independently of type is genericity
(pronounced jen-err-iss-it-ee).
E.g. Compare these two functions to return the maximum of
two numbers.
integer maxInteger (integer param1, integer param2)
{
if (param1 > param2)
{ return param1; }
return param2;
}
float maxFloat (float param1, float param2)
{
if (param1 > param2)
{ return param1; }
return param2;
}
It seems silly to have to write the two functions but if a
language doesn't allow you to pass an integer to a function
that requires a floating point parameter (or vice versa)
then this is exactly what you must do.
Some languages allow you to to write a single generic
function that will serve the same purpose for both integers
and floating point values (or any other types you like for
that matter). In general, such a function might look a
little like this.
TYPE max (TYPE param1, TYPE param2)
{
if (param1 > param2)
{ return param1; }
return param2;
}
Is This Answer Correct ? | 7 Yes | 1 No |
What is necking in production engineering ?
what are the steps u follow to create an custom idoc program in which environment u create the program?
to write a program to search a character in a string and to print till the character in the string using pointers in c program
what is elligibility criteria of hcl?
defference between menu and context menu in vb.net?
synchronous and asynchronous transmission
Please mail me the sample papers of PNB for the post Dy. Manager.
how to connect oracle with java ? Give detail explanation.
i want a richdatatable to be displayed only when a list has some value in the bean, and a datatable with header only if the list is empty. And i want the datatable to be printed only when ajax button is clicked??
How To Servers For Malitnationl Bank?
difference between a for loop and a while loop? what are its uses in c language?
PREVIOUS AND NEW companies positive and negative points AFTER LIVING