您的位置:首页 > 运维架构 > Linux

centos架设svn服务器,及自动部署到ningx网站目录

2014-04-01 21:56 477 查看
1.      Is it possible tohave Virtual Constructor? If yes, how? If not, Why not possible?There is nothinglike Virtual Constructor. The Constructor cant be virtual as the constructor isa code which is responsible for creating a instance of a class and it cant bedelegated to any other object by virtual keyword means.2.      What about VirtualDestructor?Yes there is aVirtual Destructor. A destructor can be virtual as it is possible as at runtimedepending on the type of object baller is balling to , proper destructor will becalled.3.      What is Pure VirtualFunction? Why and when it is used ?The abstractclass whose pure virtual method has to be implemented by all the classes whichderive on these. Otherwise it would result in a compilation error.Thisconstruct should be used when one wants to ensure that all the derived classesimplement the method defined as pure virtual in base class.4.      What is problem withRuntime type identification?The run timetype identification comes at a cost of performance penalty. Compiler maintainsthe class.5.      How Virtualfunctions call up is maintained?Through Look uptables added by the compile to every class image. This also leads to performancepenalty.6.      Can inline functionshave a recursion?No.Syntaxwise It is allowed. But then the function is no longer Inline. As the compilerwill never know how deep the recursion is at compilation time.7.      How do you link aC++ program to C functions?By using theextern "C" linkage specification around the C functiondeclarations.Programmers should know about mangled function names andtype-safe linkages. Then they should explain how the extern "C"linkagespecification statement turns that feature off during compilation so that thelinker properly links function calls to C functions.8.      Explain the scoperesolution operator?It permits aprogram to reference an identifier in the global scope that has been hidden byanother identifier with the same name in the local scope.9.      How many ways arethere to initialize an intwith a constant?1. int foo =123;2. int bar(123);10.   What is yourreaction to this line of code?deletethis;It is not a good programming Practice.A good programmer willinsist that you should absolutely never use the statement if the class is to beused by other programmers and instantiated as static, extern, or automaticobjects. That much should be obvious.The code has two built-in pitfalls.First, if it executes in a member function for an extern, static, or automaticobject, the program will probably crash as soon as the deletestatementexecutes. There is no portable way for an object to tell that it wasinstantiated on the heap, so the class cannot assert that its object is properlyinstantiated. Second, when an object commits suicide this way, the using programmight not know about its demise. As far as the instantiating program isconcerned, the object remains in scope and continues to exist even though theobject did itself in. Subsequent dereferencing of the baller can and usuallydoes lead to disaster. I think that the language rules should disallow theidiom, but that's another matter.11.   What is thedifference between a copy constructor and an overloaded assignmentoperator?A copyconstructor constructs a new object by using the content of the argument object.An overloaded assignment operator assigns the contents of an existing object toanother existing object of the same class.12.   When should you usemultiple inheritance?There are threeacceptable answers:- "Never," "Rarely," and "When the problem domain cannot beaccurately modeled any other way."Consider anAssetclass, Buildingclass, Vehicleclass, andCompanyCarclass. All company cars are vehicles. Some company cars areassets because the organizations own them. Others might be leased. Not allassets are vehicles. Money accounts are assets. Real estate holdings are assets.Some real estate holdings are buildings. Not all buildings are assets. Adinfinitum. When you diagram these relationships, it becomes apparent thatmultiple inheritance is a likely and intuitive way to model this common problemdomain. The applicant should understand, however, that multiple inheritance,like a chainsaw, is a useful tool that has its perils, needs respect, and isbest avoided except when nothing else will do.13.   What is a virtualdestructor?The simpleanswer is that a virtual destructor is one that is declared with the virtualattribute.The behavior of a virtual destructor is what is important. If youdestroy an object through a baller or reference to a base class, and thebase-class destructor is not virtual, the derived-class destructors are notexecuted, and the destruction might not be comple14.   Can a constructorthrow a exception? How to handle the error when the constructorfails?The constructornever throws a error.15.   What are thedebugging methods you use when came across a problem?Debugging withtools like :GDB, DBG, Forte, VisualStudio.Analyzing the Coredump.Using tusc to trace thelast system call before crash.Putting Debugstatements in the program source code.16.   How the compilersarranges the various sections in the executable image?The executablehad following sections:-Data Section(uninitialized data variable section, initialized data variable section )Code SectionRemember that allstatic variables are allocated in the initialized variable section.17.   Explain the ISA andHASA class relationships. How would you implement each in a classdesign?A specializedclass "is" a specialization of another class and, therefore, has the ISArelationship with the other class.This relationship is best implemented byembedding an object of the Salaryclass in the Employeeclass.18.   When is a template abetter solution than a base class?When you aredesigning a generic class to contain or otherwise manage objects of other types,when the format and behavior of those other types are unimportant to theircontainment or management, and particularly when those other types are unknown(thus, the generality) to the designer of the container or manager class.19.   What are thedifferences between a C++ structand C++ class?The defaultmember and base-class access specifies are different.This is one of thecommonly misunderstood aspects of C++. Believe it or not, many programmers thinkthat a C++ structis just like a C struct, while a C++ class hasinheritance, access specifies, member functions, overloaded operators, and soon. Actually, the C++ structhas all the features of the class.The only differences are that a structdefaults to public member accessand public base-class inheritance, and a classdefaults to the privateaccess specified and private base-class inheritance.20.   How do you know thatyour class needs a virtual destructor?If your classhas at least one virtual function, you should make a destructor for this classvirtual. This will allow you to delete a dynamic object through a baller to abase class object. If the destructor is non-virtual, then wrong destructor willbe invoked during deletion of the dynamic object.21.   What is thedifference between new/delete and malloc/free?Malloc/free donot know about constructors and destructors. New and delete create and destroyobjects, while malloc and free allocate and deallocate memory.22.   What happens when afunction throws an exception that was not specified by an exceptionspecification for this function?Unexpected() iscalled, which, by default, will eventually trigger abort().23.   Can you think of asituation where your program would crash without reaching the breakball, whichyou set at the beginning of main()?C++ allows fordynamic initialization of global variables before main() is invoked. It ispossible that initialization of global will invoke some function. If thisfunction crashes the crash will occur before main() is entered.24.   What issue doauto_ptr objects address?If you useauto_ptr objects you would not have to be concerned with heap objects not beingdeleted even if the exception is thrown.25.   Is there any problemwith the following:char *a=NULL;char& p = *a;?The result is undefined. You should never do this. Areference must always refer to some object.26.   Why do C++ compilersneed name mangling?Name mangling isthe rule according to which C++ changes function's name into function signaturebefore passing that function to a linker. This is how the linker differentiatesbetween different functions with the same name.27.   Is there anythingyou can do in C++ that you cannot do in C?No. There is nothing you can doin C++ that you cannot do in C. After all you can write a C++ compiler in C What are the major differencesbetween C and C++?What are the differences between
new
and
malloc
?What is the difference between
delete
and
delete[]
?What are the differences between astruct in C and in C++?What are theadvantages/disadvantages of using
#define
?What are theadvantages/disadvantages of using
inline
and
const
?What is the difference between aballer and a reference?When would you use a baller? Areference?What does it mean to take theaddress of a reference?What does it mean to declare afunction or variable as
static
?What is the order of initalizationfor data?What is name mangling/namedecoration?What kind of problems does namemangling cause?How do you work around them?What is a class?What are the differences between astruct and a class in C++?What is the difference betweenpublic, private, and protected access?For
class CFoo {
};
whatdefault methods will the compiler generate for you>?How can you force the compiler tonot generate them?What is the purpose of aconstructor? Destructor?What is a constructor initializerlist?When mustyou use aconstructor initializer list?What is a:Constructor?Destructor?Default constructor?Copy constructor?Conversion constructor?What does it mean to declare a...member function as
virtual
?member function as
static
?member function as
static
?member variable as
static
?destructor as
static
?Can you explain the term "resourceacquisition is initialization?"What is a "pure virtual" memberfunction?What is the difference betweenpublic, private, and protected inheritance?What is virtual inheritance?What is placement
new? What is thedifference between
operator newand the
newoperator?What is exception handling?Explain what happens when anexception is thrown in C++.What happens if an exception isnot caught?What happens if an exception isthrows from an object's constructor?What happens if an exception isthrows from an object's destructor?What are the costs and benefits ofusing exceptions?When would you choose to return anerror code rather than throw an exception?What is a template?What is partial specialization ortemplate specialization?How can you force instantiation ofa template?What is an iterator?What is an algorithm (in terms ofthe STL/C++ standard library)?What is
std::auto_ptr?What is wrong withthis statement?
std::auto_ptr ptr(newchar[10]);It is possible to build a C++compiler on top of a C compiler. How would you do this? 
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: