C++常见英文面试笔试题C/C++ProgramminginterviewquestionsandanswersBySatishShetty,July14th,Whatisencapsulation??Containingandhidinginformationaboutanobject,suchasinternaldatastructuresandcode.Encapsulationisolates(使隔离)theinternalcomplexityofanobject'soperationfromtherestoftheapplication.Forexample,aclientcomponentaskingfornetrevenue(收益)fromabusinessobjectneednotknowthedata'sorigin.Whatisinheritance?Inheritanceallowsoneclasstoreusethestateandbehaviorofanotherclass.Thederivedclassinheritsthepropertiesandmethodimplementationsofthebaseclassandextendsitbyoverridingmethodsandaddingadditionalpropertiesandmethods.WhatisPolymorphism??Polymorphismallowsaclienttotreatdifferentobjectsinthesamewayeveniftheywerecreatedfromdifferentclassesandexhibit(展现)differentbehaviors.Youcanuseimplementation(实现)inheritancetoachievepolymorphisminlanguagessuchasC++andJava.Baseclassobject'spointercaninvoke(调用)methodsinderivedclassobjects.YoucanalsoachievepolymorphisminC++byfunctionoverloadingandoperatoroverloading.Whatisconstructororctor?Constructorcreatesanobjectandinitializesit.Italsocreatesvtable变量列
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
?forvirtualfunctions.Itisdifferentfromothermethodsinaclass.Whatisdestructor?Destructorusuallydeletesanyextraresourcesallocatedbytheobject.Whatisdefaultconstructor?Constructorwithnoargumentsoralltheargumentshasdefaultvalues.Whatiscopyconstructor?Constructorwhichinitializestheit'sobjectmembervariables(byshallowcopying)withanotherobjectofthesameclass.Ifyoudon'timplementoneinyourclassthencompilerimplementsoneforyou.forexample:BooObj1(1O);IIcallingBooconstructorBooObj2(Obj1);〃callingboocopyconstructorBooObj2=Obj1;〃callingboocopyconstructorWhenarecopyconstructorscalled?Copyconstructorsarecalledinfollowingcases:whenafunctionreturnsanobjectofthatclassbyvaluewhentheobjectofthatclassispassedbyvalueasanargumenttoafunctionwhenyouconstructanobjectbasedonanotherobjectofthesameclassWhencompilergeneratesatemporaryobjectWhatisassignmentoperator?Defaultassignmentoperatorhandlesassigningoneobjecttoanotherofthesameclass.Membertomembercopy(shallowcopy)Whatarealltheimplicitmemberfunctionsoftheclass?Orwhatareallthefunctionswhichcompilerimplementsforusifwedon'tdefineone.??defaultctorcopyctorassignmentoperatordefaultdestructoraddressoperatorWhatisconversionconstructor?constructorwithasingleargumentmakesthatconstructorasconversionctoranditcanbeusedfortypeconversion.forexample:classBoo{public:Boo(inti);};BooBooObject=10;//assigningint10Booobject