Technical Interview Questions and Answers :: C++
i. A class is said to be abstract class that represents the interface to a set of implementations of a common concept.
ii. The abstract class provides the common interface to the implementation. This means, we can use a set without knowing which kind of implementation is used.
1. We require a redesign of the implementation classes to express commonality and issued a template to exploit it.
2. If the implementation changes significantly the interface is usually modified to reflect the change.
1. Design a common interface but no commonality beyond re-ability to implement the interface.
2. Users need not depend on these declarations and need not be recompiled or in any way changed if set changes.
i. Define a single concept in the array that allows several implementations of it to coexist in a program.
ii. Provide reasonable run-time and space efficiency through the use of virtual functions .
iii. Each implementation have only minimal dependency on other classes.
iv. Comprehensible in isolation.
i. Efficiency : - We want to have concrete types such as vector and list without the overheads implied by decoupling the implementations from the interfaces.
ii. Reuse : - We need a mechanism to fit types designed elsewhere into a new library or application by giving them a new interface.
iii. Multiple interfaces : - Using a single common base fro a variety of classes leads to fat interfaces. Often it is better to provide a new interface to a class for new purposes rather than modify its interface to serve multiple purposes.
A node class relies on services from base classes to provides its own services. That is, it calls base class member functions. A typical node class provides not just an implementation of the interface specified by its base class. It also adds new functions itself, thus providing a wider interface.
The important functions are the constructor through which the programmer specifies the basic properties that are relevant to the simulation and the virtual functions that allow the simulation routines to manipulate a public variable without knowing its exact type.
i. relies on its base classes both for its implementation and for supplying services to its users.
ii. Provides a wider interface (i.e an interface with more public members) to its users than do its base classes.
iii. Relies primarily on virtual functions in its public interface.
iv. Depends on all of its( direct and indirect) base classes.
v. Can be understood only in the contest of its base classes.
vi. Can be used as a base for further derivation.
vii. Can be used to create objects.
A class that does not confirm to point base for further derivation resembles on concrete type and could be called as concrete node types.
A concrete node class can be used to implement an abstract class and variables of such a class can be allocated statically and on the stack. Such a class is sometimes called as leaf class.
A class that does not confirm to create objects resembles on the abstract type and it is called as abstract node types.
You can check latest and updated C++ Inheritance 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.