Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the term genericity in oops?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Can one be shocked holding a wire carrying a very large current with a low voltage source?

1978


Differences between Java and C++? which is faster?

2110


how strcpy usingrecursive function

2026


Qatar petroleum will call me for an technical phone interview as safety officer Please let me know what kind of question they asked ? any idea about this written test ?

6584


Hi i want some previous interview questions and answers for KVB Bank.

2618


if a customer's blackberry stopped syncing their calendar wirelessly what would you do?if a customber deleted mail from his blackberry but it did delete from his mailbox how would ypu resolve this

3025


How we calculate the recovery of steam as per coal in a boiler if we know the calorific value of coal?

1802


please tell me difference between router and cisco router

2088


AD backups and restoration

2039


1) There is a circular pizza with negligible thickness that is cut into 'x' pieces by 4 straight line cuts. What is the maximum and minimum value of 'x' respectively 2)A ship leaves on a long voyage. When it is 18 miles from the shore, a seaplane, whose speed is 10 times that of the ship is sent to deliver mail. How far from the shore does the seaplane catch upon with the ship? 3) If the distance traveled (s) in time (t) by a particle is given by the formula s = 1+ 2t+3t2+4t3, then what is the distance traveled in the 4th second of its motion? 4)3 men finish painting a wall in 8 days. Four boys do the same job in 7 days. In how many days will 2 men and 2 boys working together paint two such walls of the same size?

3828


pls send me rrb se(s&t)questions

2234


What is "strstream" ?

2119


find the salary of an employee where employee number is known

1909


what is rapid application development

1739


I have Cleared Bank of India Clerical Examination.I just want to know how to prepare for interview and what are the parriculars that I have to submit......Pls someone help me with it

1935