c_常见英文面试笔试题(编辑修改稿)内容摘要:

t class? When you define only function prototype in a base class without implementation and do the plete implementation in derived class. This base class is called abstract class and client won39。 t able to instantiate an object using this base class. You can make a pure virtual function or abstract class this way.. class Boo { void foo() = 0。 } Boo MyBoo。 // pilation error What is Memory alignment?? The term alignment primarily means the tendency of an address pointer value to be a multiple of some power of two. So a pointer with two byte alignment has a zero in the least significant bit. And a pointer with four byte alignment has a zero in both the two least significant bits. And so on. More alignment means a longer sequence of zero bits in the lowest bits of a pointer. What problem does the namespace feature solve? Multiple providers of libraries might use mon global identifiers causing a name collision when an application tries to link with two or more such libraries. The namespace feature surrounds a library39。 s external declarations with a unique namespace that eliminates the potential for those collisions. namespace [identifier] { namespacebody } A namespace declaration identifies and assigns a name to a declarative region. The identifier in a namespace declaration must be unique in the declarative region in which it is used. The identifier is the name of the namespace and is used to reference its members. What is the use of 39。 using39。 declaration? A using declaration makes it possible to use a name from a namespace without the scope operator. What is an Iterator class? A class that is used to traverse through the objects maintained by a container class. There are five categories of iterators: input iterators, output iterators, forward iterators, bidirectional iterators, random access. An iterator is an entity that gives access to the contents of a container object without violating encapsulation constraints. Access to the contents is granted on a oneatatime basis in order. The order can be storage order (as in lists and queues) or some arbitrary order (as in array indices) or according to some ordering relation (as in an ordered binary tree). The iterator is a construct, which provides an interface that, when called, yields either the next element in the container, or some value denoting the fact that there are no more elements to examine. Iterators hide the details of access to and update of the elements of a container class. Something like a pointer. What is a dangling pointer? A dangling pointer arises when you use the address of an object after its lifetime is over. This may occur in situations like returning addresses of the automatic variables from a function or using the address of the memory block after it is freed. What do you mean by Stack unwinding? It is a process during exception handling when the destructor is called for all local objects in the stack between the place where the exception was thrown and where it is caught. Name the operators that cannot be overloaded?? sizeof, ., .*, ., ::, ?: What is a container class? What are the types of container classes? A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a wellknown interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container。 when the container is holding a group of objects that are all the same, the container is called a homogeneous container. What is inline function?? The __inline keyword tells the piler to substitute the code within the function definition for every instance of a function call. However, substitution occurs only at the piler39。 s discretion. For example, the piler does not inline a function if its address is taken or if it is too large to inline. What is overloading?? With the C++ language, you can overload functions and operators. Overloading is the practice of supplying more than one definition for a given function name in the same scope. Any two functions in a set of overloaded functions must have different argument lists. Overloading functions with argument lists of the same types, based on return type alone, is an error. What is Overriding? To override a method, a subclass of the class that originally declared the method must declare a method with the same name, return type (or a subclass of that return type), and same parameter list. The defi。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。