Dab tsi yog hom opaque hauv C?
Dab tsi yog hom opaque hauv C?

Video: Dab tsi yog hom opaque hauv C?

Video: Dab tsi yog hom opaque hauv C?
Video: Tus Tseem Poj Laib Ces Yog Kuv | Npauj Nyiag Yaj | Ma Ya | Official MV 2023 2024, Kaum ib hlis
Anonim

Hom opaque yog, ib feem, ib txoj kev ua C ntau yam-oriented. Lawv tso cai encapsulation, kom cov ntsiab lus sab hauv ntawm a hom tuaj yeem hloov pauv--los yog siv tau sib txawv hauv ntau lub platforms / xwm txheej--tsis muaj cov cai uas siv nws yuav tsum tau hloov.

Ua kom pom qhov no, dab tsi yog hom ntaub ntawv opaque hauv C?

Ib hom ntaub ntawv opaque yog a hom nws qhov kev siv yog zais ntawm tus neeg siv. Tib txoj kev siv hom ntaub ntawv opaque yog los ntawm kev paub daws teeb pointer interface nthuav tawm hauv API. Ib qho piv txwv nto moo yog FILE hom ntaub ntawv hauv C standard I/O tsev qiv ntawv. h) thiab tseem muab tus neeg siv tus phooj ywg pointer interface tshaj tawm.

Qhov thib ob, tus nqi opaque yog dab tsi? " Opaque " yog txhais, ua lus Askiv, raws li "tsis tuaj yeem pom los ntawm; Tsis pob tshab” Hauv Computer Science, qhov no txhais tau tias a tus nqi uas qhia tsis paub meej lwm yam ces hom ntawm cov tus nqi nws tus kheej. Cov neeg feem ntau siv C hom FILE ua piv txwv classic tab sis feem ntau qhov no tsis yog opaque - cov ntsiab lus tau nthuav tawm hauv stdio.

Tsis tas li ntawd, qhov opaque qauv yog dab tsi?

Hauv computer science, ib opaque hom ntaub ntawv yog ib hom ntaub ntawv uas nws cov ntaub ntawv tseem ceeb qauv tsis tau txhais nyob rau hauv ib tug interface. Qhov no tswj cov ntaub ntawv zais, vim nws qhov tseem ceeb tsuas yog siv tau los ntawm kev hu xov tooj rau subroutines uas tau nkag mus rau cov ntaub ntawv ploj lawm.

Dab tsi yog txoj hauv kev zoo tshaj plaws ntawm kev siv opaque abstract cov ntaub ntawv hom hauv C?

A: Ib txoj kev zoo yog rau cov neeg siv cov qauv taw qhia (tej zaum tseem muab zais tom qab typedefs) uas taw tes rau cov qauv hom uas tsis tau txhais rau pej xeem.

Pom zoo: