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 |
I want to know the relation between GI pipe ID, water flow rate in lpm, static head and friction head losses, motor kw for that flow etc.
what are the simlerities between macro and subroutine
MY interview Experience with TCS
Tell me a bit about the capabilities of Exchange Server 2003.
differance between radix sort and radix exchange sort
Proove it 3+4=5
Phong shading refers to describe
could u please tell me where the click view tool coaching in hyderabad
WHO IS STAR....?
What do u mean constructor in java ?
10. Each alphabet stands for one digit in the following multiplication. T H I S x I S --------- X F X X X X U X ------------ X X N X X ------------ What is the maximum value T can take?
4 Answers eLitmus, Infosys, Verchaska,
What is the definition of gain?
Civil Engineering (5086)
Mechanical Engineering (4456)
Electrical Engineering (16639)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)