Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Topic: “Inheritance is one of most important and usefulconcepts but still c++ St

ID: 3612343 • Letter: T

Question

Topic:
“Inheritance is one of most important and usefulconcepts but still c++ Standard TemplateLibrary (STL) doesn’t prefer to use inheritance. What doyou think might be the reason? ”                                    (plz explain in 8 to 9 lines) Topic:
“Inheritance is one of most important and usefulconcepts but still c++ Standard TemplateLibrary (STL) doesn’t prefer to use inheritance. What doyou think might be the reason? ”                                    (plz explain in 8 to 9 lines)                                    (plz explain in 8 to 9 lines)

Explanation / Answer

Dear,

      

STL does not use inheritance to any great extent. Instead itrelies heavily on composition of its generic components to providefor specialization. Thus stack does not inherit from list, deque orvector. It is instead a generic composition from any containerproviding the required functionality. We will create multipleinheritance (i.e. class A: public B, public C {}) unless creatinginterface instead of implementation. Otherwise, you'll run into allsorts of problems with conflicting members, especially if someoneelse owns a base class. The best time to use multiple inheritanceis when a subclass multiply inherits from abstract base classeswith only pure virtual functions.