Qhov txawv ntawm C thiab C ++

Qhov txawv ntawm C thiab C ++
Qhov txawv ntawm C thiab C ++

Video: Qhov txawv ntawm C thiab C ++

Video: Qhov txawv ntawm C thiab C ++
Video: Настя и Арбуз со сказочной историей для детей 2024, Kaum ib hlis
Anonim

C vs C++

C thiab C ++ yog ob hom lus programming. C yog hom lus txheej txheem txheej txheem thaum C ++ yog hom lus hais lus programming. Muaj qee qhov tsis zoo hauv hom C. Yog li ntawd, C ++ tau tsim.

Tus lus C

C yog lub khoos phis tawj programming lus tsim tawm xyoo 1972 ntawm Bell Labs. Nws yog tsim los siv nrog UNIX operating system. Sib nrug los ntawm kev tsim cov software software, C lus kuj tseem siv los tsim cov ntawv thov mobile. Cov txheej txheem kev ua haujlwm yog muab los ntawm C hom lus thiab nws tso cai rau kev rov ua dua nrog rau cov lexical kuj sib txawv. Kev ua haujlwm tsis xav tau yog tiv thaiv los ntawm hom zoo li qub.

Functions muaj tag nrho cov lej ua tiav ntawm C hom lus thiab qhov tsis ua haujlwm tau dhau los ntawm tus nqi. Pointer qhov tseem ceeb yog siv thaum muaj nuj nqi tsis dhau los ntawm kev siv. Txhawm rau txiav tawm ib nqe lus, semicolon yog siv.

Ua raws li cov yam ntxwv ntawm C hom:

• Ad-hoc khiav lub sij hawm polymorphism tau txais kev txhawb los ntawm cov ntaub ntawv thiab kev ua haujlwm taw qhia.

• Reserved keywords me.

• Ntau yam ntawm cov neeg ua haujlwm sib txuas xws li ++, -=, +=thiab lwm yam.

• Kev muab tso ua ke, cov ntaub ntawv suav nrog ntawm qhov chaws thiab cov txheej txheem macro txhais ua ntej.

Ib pawg ntawm kev ua haujlwm tau siv ua lus C. Txhua qhov kev zov me nyuam hauv C lus raug ua tiav hauv txoj haujlwm hu ua "kev ua haujlwm tseem ceeb."

C++ Lus

C++ kuj yog ib hom lus siv computer. C ++ yog qib siab thiab hom lus taw qhia. C ++ yog qhov feem ntau siv ntawm txhua hom lus programming. C ++ tau tsim los ntawm Tswb Laboratories thiab nws hu ua qhov kev txhim kho ntawm C lus. Cov yam ntxwv ntawm C ++ muaj xws li cov qauv, cov chav kawm, tus neeg teb xov tooj overloading thiab virtual functions. Kev zam tuav thiab ntau yam qub txeeg qub teg kuj tau qhia hauv C ++. Raws li piv cov lus C, ntau hom kev tshuaj xyuas muaj nyob hauv C ++.

Raws li nws tau suav tias yog qhov kev txhim kho ntawm cov lus C, feem ntau ntawm cov yam ntxwv ntawm C yog khaws cia hauv C ++. Txawm hais tias C ++ compilers tuaj yeem khiav cov kev pab cuam tsim hauv C. Txawm li cas los xij, qee qhov chaws sau hauv C tej zaum yuav tsis sib haum nrog C ++ compilers.

C ++ yog thawj zaug tsim rau UNIX system. Cov lej sau hauv C ++ yog rov siv tau dua uas txhais tau hais tias kev hloov kho tuaj yeem ua tiav hauv cov lej yam tsis hloov pauv. C ++ yog portable kuj txhais tau hais tias nws yog ywj siab ntawm kev khiav hauj lwm qhov system los yog nws tsis xav tau tshwj xeeb kho vajtse.

Class yog lwm qhov tseem ceeb tshaj tawm hauv C ++. Cov cai tuaj yeem tsim nrog kev pab ntawm cov chav kawm. Los ntawm kev siv cov chav kawm, cov kab no tuaj yeem raug tshem tawm thiab kho tau yooj yim.

Qhov txawv ntawm C thiab C ++

• C yog hom lus txheej txheem txheej txheem whereas C ++ yog hom lus taw qhia cov lus programming.

• C++ tau qhia txog lub tswvyim ntawm polymorphism, qub txeeg qub teg overloading whereas cov no tsis muaj nyob rau hauv C.

• Object oriented mus kom ze xws li cov khoom thiab cov chav kawm yog siv C ++ lus.

• Txawm hais tias feem ntau ntawm C cov kev pab cuam tuaj yeem muab tso ua ke siv C ++ compilers tab sis tseem qee qhov kev pab cuam yuav tsis sib haum.