Dab tsi yog abstraction OOP?
Dab tsi yog abstraction OOP?

Video: Dab tsi yog abstraction OOP?

Video: Dab tsi yog abstraction OOP?
Video: Kuv yog tus nyab niam pog tsis nyiam 5/7/2023 2024, Kaum ib hlis
Anonim

Dab tsi yog Abstraction hauv OOP ? Abstraction yog xaiv cov ntaub ntawv los ntawm lub pas dej loj loj kom pom cov ntsiab lus cuam tshuam rau cov khoom. Nws pab txo cov programming nyuaj thiab siv zog. Hauv Java, abstraction isaccomplished siv Abstract chav kawm thiab interfaces. Nws yog ib lub ntsiab lus tseem ceeb tshaj plaws ntawm OOPs.

Kuj nug, dab tsi yog abstraction hauv OOP nrog piv txwv?

Abstraction txhais tau tias tsuas yog nthuav tawm cov ntaub ntawv tseem ceeb thiab zais cov ntsiab lus. Cov ntaub ntawv abstraction hais txog tsuas yog muab cov ntaub ntawv tseem ceeb ntawm cov ntaub ntawv mus rau lub ntiaj teb sab nraud, zais cov ntsiab lus keeb kwm yav dhau los lossis kev siv. Xav txog lub neej tiag tiag piv txwv ntawm ib tug neeg tsav tsheb acar.

Ib qho piv txwv ntawm abstraction yog dab tsi? npe. Lub ntsiab txhais ntawm abstraction yog ib lub tswv yim uas tsis muaj qhov xwm txheej, lossis yog qhov zoo tshaj plaws hauv qhov xwm txheej. Piv txwv ntawm abstractions tuaj yeem yog kev xav xws li kev ntxhov siab lossis kev zoo siab. Abstraction txhais tau tias yog ib qho haujlwm ntawm kev kos duab uas qhov kev kawm lossis lub ntsiab lus tau piav qhia.

Ib yam li ntawd, lub ntsiab lus ntawm abstraction hauv OOP yog dab tsi?

Hauv object-oriented programming , abstraction yog ib qho ntawm peb lub hauv paus ntsiab lus (nrog rau encapsulation thiab qub txeeg qub teg). Los ntawm cov txheej txheem ntawm abstraction , tus programmer zais tag nrho tab sis cov ntaub ntawv cuam tshuam txog ib yam khoom txhawm rau txo qhov nyuaj thiab ua kom muaj txiaj ntsig.

Chav kawm abstraction yog dab tsi?

Hauv programming lus, ib chav kawm abstract yog ageneric chav kawm (los yog hom khoom) siv los ua lub hauv paus tsim cov khoom tshwj xeeb uas ua raws li nws cov txheej txheem, lossis kev teeb tsa kev ua haujlwm uas nws txhawb nqa. Cov chav kawm Abstract yog notinstantiated ncaj qha.

Pom zoo: