Technical Discussion :: C++
Home > Technical Interview Q&A > C++ > Discussion
144 / 187
Why do we have concrete types when we have abstract type?
Answer:
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.
Asked In ::
Amit Yadav
23 Feb, 2019 5:07 AM
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.
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.