Nyob rau hauv oop twg ntawm cov hauv qab no txhais cov parametric polymorphism?

Cov txheej txheem:

Nyob rau hauv oop twg ntawm cov hauv qab no txhais cov parametric polymorphism?
Nyob rau hauv oop twg ntawm cov hauv qab no txhais cov parametric polymorphism?
Anonim

Hauv cov lus programming thiab hom kev xav, parametric polymorphism yog ib txoj hauv kev los ua kom cov lus nthuav tawm ntau dua, thaum tseem tuav tag nrho cov yam ntxwv zoo li qub-kev nyab xeeb. Siv parametric polymorphism, muaj nuj nqi lossis hom ntaub ntawv tuaj yeem sau tau dav dav kom nws tuaj yeem lis cov txiaj ntsig zoo ib yam yam tsis muaj nyob ntawm lawv hom.

Qhov twg hauv qab no yog qhov tseeb piav qhia parametric polymorphism?

Parametric polymorphism yog cov txheej txheem hais lus uas ua kom lub ntsiab lus dav dav ntawm kev ua haujlwm thiab hom, yam tsis muaj kev txhawj xeeb ntau rau hom kev ua yuam kev. Nws tso cai rau cov lus nthuav tawm ntau dua thaum sau cov lej lej uas siv rau ntau hom ntaub ntawv.

Dab tsi yog parametric polymorphism thiab subtype polymorphism?

Subtype polymorphism muab ib lo lus ntau ntau hom siv txoj cai subsumption. … Parametric polymorphism yog hais txog rau tus lej uas sau tsis paub txog hom kev sib cav tiag tiag; cov code yog parametric nyob rau hauv hom ntawm cov tsis. Piv txwv suav nrog polymorphic ua haujlwm hauv ML, lossis generics hauv Java 5.

Parametric polymorphism Java yog dab tsi?

Parametric polymorphism qhia tias hauv chav kawm tshaj tawm, lub npe teb tuaj yeem koom nrog ntau hom thiab lub npe hom tuaj yeem koom nrog ntau qhov sib txawv thiab rov qab hom. Lub teb thiab txoj kev tuaj yeemtom qab ntawd muab ntau hom sib txawv hauv txhua chav piv txwv (khoom).

Dab tsi yog implicit parametric polymorphism?

Dab tsi yog implicit parametric polymorphism? Qhia meej parametric polymorphism: generic parameters T. Los ntawm Programming Language Pragmatics "Nyob rau hauv parametric polymorphism lub code siv ib hom (los yog txheej ntawm hom) raws li ib qho parameter, explicitly los yog implicitly."

Pom zoo: