Dab tsi yog qhov sib txawv access modifiers?
Dab tsi yog qhov sib txawv access modifiers?

Video: Dab tsi yog qhov sib txawv access modifiers?

Video: Dab tsi yog qhov sib txawv access modifiers?
Video: Xwm Kab Yog Dab Tsi?: Hmoob Nkag Siab Yuam Kev Tag Lawm 2024, Hlis ntuj nqeg
Anonim

Access Modifiers Hom . C# muab plaub hom ntawm nkag mus modifiers : ntiag tug, pej xeem, tiv thaiv, sab hauv, thiab ob qho tib si: tiv thaiv-hauv thiab ntiag tug-tiv thaiv.

Kuj nug, dab tsi yog class access modifiers?

Access modifiers (los yog nkag mus specifiers) yog cov lus tseem ceeb hauv cov lus taw qhia uas teeb tsa kev nkag mus tau ntawm chav kawm , txoj kev, thiab lwm yam tswv cuab. Access modifiers yog ib feem ntawm programming lus syntax siv los pab txhawb lub encapsulation ntawm cov khoom. A chav kawm tsis tuaj yeem tshaj tawm tias yog tus kheej.

Ib tug kuj yuav nug, dab tsi yog qhov txwv tsis pub nkag mus hloov kho? Tus kheej

Ib yam li ntawd, dab tsi yog qhov sib txawv nkag mus hloov pauv hauv Java?

Java muab kev tswj xyuas los ntawm peb lo lus tseem ceeb - tus kheej , tiv thaiv thiab pej xeem. Peb tsis tas yuav siv cov kev hloov pauv kev nkag mus ib txwm, yog li peb muaj lwm qhov hu ua " ua ntej nkag", "package- tus kheej "los yog "tsis muaj kev hloov pauv".

Vim li cas peb thiaj siv cov kev hloov pauv hloov?

Access modifiers yog siv rau encapsulation: lawv tso cai rau koj los npaj koj cov cai hauv cov pob khoom thiab cov chav kawm, thiab tsuas yog muaj "kev cai" pej xeem cuam tshuam pom rau sab nraud, thaum zais cov ntsiab lus siv (uas koj xav tau. ua , yog li koj tuaj yeem hloov pauv yam tsis tau qhia leej twg).

Pom zoo: