Ib qho piv txwv ntawm chav kawm yog dab tsi?
Ib qho piv txwv ntawm chav kawm yog dab tsi?

Video: Ib qho piv txwv ntawm chav kawm yog dab tsi?

Video: Ib qho piv txwv ntawm chav kawm yog dab tsi?
Video: Tshuaj theem vim li cas thiaj tau nqi ?/ Siv kho mob dab tsi?/paris polyphylla use for? 2024, Hlis ntuj nqeg
Anonim

Dab tsi yog a Chav kawm ? Hauv lub ntiaj teb tiag tiag, koj feem ntau muaj ntau yam khoom ntawm tib yam. Rau piv txwv , koj lub tsheb kauj vab tsuas yog ib qho ntawm ntau lub tsheb kauj vab hauv ntiaj teb. Siv cov lus hais txog cov khoom siv, peb hais tias koj lub tsheb kauj vab yog ib qho piv txwv. ntawm chav kawm ntawm cov khoom hu ua tsheb kauj vab.

Hauv qhov no, dab tsi yog chav kawm hauv oops nrog piv txwv?

Chav kawm : A chav kawm hauv C ++ yog lub tsev thaiv, uas ua rau Object-Oriented programming . Nws yog tus neeg siv cov ntaub ntawv teev tseg, uas tuav nws tus kheej cov ntaub ntawv cov tswv cuab thiab cov tswv cuab kev ua haujlwm, uas tuaj yeem nkag mus thiab siv los ntawm kev tsim ib qho piv txwv ntawm qhov ntawd. chav kawm . Rau Piv txwv : Xav txog qhov Chav kawm ntawm Tsheb.

Tsis tas li ntawd, dab tsi yog chav kawm thiab dab tsi yog qhov khoom? Chav kawm piv khoom A chav kawm yog template rau khoom . A chav kawm txhais khoom cov khoom suav nrog cov khoom siv tau zoo, thiab tus nqi pib. A chav kawm kuj piav khoom tus cwj pwm. Ib khoom yog ib tug tswv cuab los yog "piv txwv" ntawm a chav kawm.

Kuj paub yog, dab tsi yog chav kawm hauv nws?

Nyob rau hauv object-oriented programming, a chav kawm yog ib tug template txhais ntawm txoj kev s thiab sib txawv s nyob rau hauv ib tug tej yam khoom. Yog li, ib yam khoom yog ib qho piv txwv tshwj xeeb ntawm a chav kawm ; nws muaj cov txiaj ntsig tiag tiag tsis yog hloov pauv. A chav kawm tuaj yeem muaj subclasses uas tuaj yeem tau txais txiaj ntsig tag nrho lossis qee yam ntawm cov yam ntxwv ntawm cov chav kawm.

Dab tsi yog qhov kev txhais zoo tshaj plaws ntawm chav kawm?

A chav kawm yog siv nyob rau hauv object-oriented programming los piav ib los yog ntau yam khoom. Nws ua haujlwm raws li tus qauv tsim, lossis instantiating, cov khoom tshwj xeeb hauv qhov kev zov me nyuam. Thaum txhua yam khoom tsim los ntawm ib leeg chav kawm , ib chav kawm yuav siv tau los instantiate ntau yam khoom.

Pom zoo: