Technical Interview Questions and Answers :: C++
1. What is meant by node classes?| | |
2. What are the uses of changing interface?| | |
3. Define changing interfaces.| | |
4. What is meant by action?| | |
5. What is meant by interface classes?| | |
6. What are the uses of interface classes?| | |
7. What is handle classes?| | |
8. Explain the uses of handling classes.| | |
9. What are the operations in handles?| | |
10. Define application frameworks.| | |
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.