C++ is an enhanced version of the C language. C++ includes everything that is part of C and adds support for object- oriented programming (OOP). In addition, C++ also contains many improvements and features that make it a "better C", independent of object oriented programming. C++ is actually an extendible language since we can define new types in such a way that they act just like the predefined types which are part of the standard language.
If you just use C++ as a better C, you will not be using all of its power. Like any quality tool, C++ must be used the way it was designed to be used to exploit its richness. Some of the new features include encapsulation, inline function calls, overloading operators, inheritance and polymorphism. I am not going to explain what they mean here as that would simply take me away from my purpose here, but you can refer to any good C++ book or the C++ FAQ for more information.
C++ Language Interviews are getting tough these days as the technology grows faster. To get through the C++ Language interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed C++ Language questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on C++ Language and various other technologies interview preparation.
21. Name some pure object oriented languages.
Smalltalk, Java, Eiffel, Sather.
22. Name the operators that cannot be overloaded.
sizeof, ., .*, .->, ::, ?: Salam in the comments notes that -> can be overloaded.
23. What about Virtual Destructor?
Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object baller is balling to , proper destructor will be called.
24. What are proxy objects?
Objects that stand for other objects are called proxy objects or surrogates. template class Array2D { public: class Array1D { public: T& operator[] (int index); const T& operator[] (int index)const; }; Array1D operator[] (int index); const Array1D operator[] (int index) const; }; The following then becomes legal: Array2Ddata(10,20); cout<< exist. not do conceptually, that, arrays one-dimensional for stand instances Its class. proxy a is Array1D example, above the In Array2D. of clients by used model conceptual from absent that array stands object Each arrays. two-dimensional live, real, using were they if as program Such exist objects latter this Objects presence aware be need Array2D Clients array. dimensional two original position(3,6) in float yields on invocation [] operator and an data[3] Here fine>
25. What are the conditions that have to be met for a condition to be an invariant of the class?
The condition should hold at the end of every constructor. The condition should hold at the end of every mutator (non-const) operation.
26. What are the debugging methods you use when came across a problem?
Debugging with tools like : GDB, DBG, Forte, Visual Studio. Analyzing the Core dump. Using tusc to trace the last system call before crash. Putting Debug statements in the program source code.
27. What are the differences between a C++ struct and C++ class?
The default member and base-class access specifies are different. This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance.
28. What do you mean by Stack unwinding?
It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and
29. What happens when a function throws an exception that was not specified by an exception specification for this function?
Unexpected() is called, which, by default, will eventually trigger abort().
30. 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 well-known 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.