Technical Interview Questions and Answers :: C++
i. A node class is a part of the class hierarchy.
ii. A class hierarchy is built with a view of derivation different from the interface/implementer view used for abstract types.
iii. A class is viewed as a foundation on which to build even if it is an abstract class, it usually has some representation and provides some services for its derived classes. An example of node classes is polygon, Ival _slider and satellite.
i. These techniques can be used to invoke a function based on a string supplied by a user.
ii. To manipulate objects of unknown type through interfaces discovered through run-time type identification.
By definition, a node class is part of a class hierarchy. Not every class in a hierarchy needs to offer the same interface. In particular, a derived class can provide more member functions, and a sibling class can provide a completely different set of functions.
The simplest and most obvious way to specify an action in C++ is to write a function. If an action has to be delayed, it has to be transmitted elsewhere before being performed, it requires its own data that has to be combined with other actions etc.,
Then is often becomes attractive to provide the action in the form of a class that can execute the desired action and provide other services as well.
i. An interface class doesnâ€™t do much if it does then it is not an interface class.
ii. It simply adjusts the appearance of some service to local needs.
iii. Interface classes are essential to allow sharing without forcing all users into a common straitjacket.
i. A major use of interface function is to adjust the interface to match users exceptions better, thus moving code that would have been scattered throughout a user's code into an interface.
ii. An interface class that controls access to another class or adjusts its interface and is sometimes called as a wrapper.
iii. Interface classes are to provide checked or restricted interfaces.
i. A handle providing the user interface and a representation holding all or most of the objectâ€™s state.
ii. The connection between the handle and the representation is typically a pointer to the handle.
iii. Handles have a bit more data than the simple representation, but not much more.
iv. The layout of a handle is typically stable even when the representation changes and also that handles are enough to move around relatively freely so that pointer and references need not be used by the user.
i. It is useful to extract the representation pointer from a handle and use it directly.
ii. It works nicely provided the called function does not destroy the object passed to it.
i. Overloading -> enables a handle to gain control and do some work on each access to an object.
ii. Handles for which work needs to be done both before and after access require more elaborate programming.
A more ambitious approach to the support of design and reuse is to provide code that establishes a common framework into which the application builder fits application â€“ specific code as building blocks. Such an approach is often called as application frameworks.
You can check latest and updated C++ Language Interview Questions and Answers on this page. You can filter the question set by the company's name. Looking for the right answer? Don't worry! You can click on view answer section and check the answer with the explanation. You can discuss the answer in the forum with other users easily. Login with Facebook and save the answer To Reading List right now!
Our site contains top IT companies placement paper and mock test to help the freshers and experienced candidate to get hands on experience on the pattern and type of questions. We have curated all the C++ technical interview questions and answers from previous candidates.