what is the term genericity in oops?



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

Post New Answer

More Engineering AllOther Interview Questions

pls send me rrb se(s&t)questions

0 Answers   RRB,


I am 2012 pass out b tech student(cse). i have recently started software manual testing class. Is this field is benefitial for me in future?

0 Answers  


what is bracking strength of helbet used in mines.

1 Answers  


How to recyling of Expired Computer/Laptop,Mouse,CPU & Key Board (Warranty)?

0 Answers  


question no. 4======Give a brief description of the following terms: a) Play head b) Symbol c) Tweening d) ActionScript e) Frame rate f) Library panel g) Masking h) Context – sensitive Property Inspector i) Bandwidth Profiler j) Frame Label

0 Answers  






difference between user and kernel mode?

0 Answers   TCL,


What are the differences between 1 dimensional RAM and 2 dimensional RAM?

0 Answers  


what are the things to be mentioned for the question "Tell me about yourself??

6 Answers   CTS, Patni,


reverse a number ( like 1234 into 4321) using malloc in C programming

0 Answers   TCY Online,


java support which type of polymorphism??runtym or compile tym or both??

1 Answers   Infosys,


hi frnds,im from andhra pradesh.i gt selected in sbi exam.my interview is on 3rd may'10.i applied under bc-e category as i belong to muslim "shaik".but nw i came to knw that it does not apply to bank exams.plz help me out.i have bc-e certificate issued by my area mro in feb'10.is this sufficient r else i had to carry other certificate..

1 Answers  


i made lan connections ,then how can i establish the network....with that connections only is the network is established ...tell me the procedure for giving the lan connection for some(10) pc's?

0 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)