SKILL BENCHMARK

C++ Inheritance and Polymorphism Competency (Intermediate Level)

  • 25m
  • 25 questions
The C++ Inheritance and Polymorphism Competency benchmark will evaluate your ability to understand how to use inheritance for is-a relationships and how to identify uses for private inheritance. You will be assessed on your skills in enumerating the order of constructor/destructor invocation in inheritance hierarchies; recognizing and working with polymorphism, abstract classes, and multiple inheritance; and outlining the use of concepts, including name hiding, static/dynamic dispatch, runtime polymorphism, virtual functions, and covariance. A learner who scores high on this benchmark demonstrates that they have the skills to recognize and implement the key concepts around inheritance and polymorphism.

Topics covered

  • access base class fields from the child class
  • access members of base and derived classes
  • compare constructors in base classes and derived classes
  • contrast is-a relationships and inheritance with has-a relationships and composition
  • create pointers to derived and base class objects
  • demonstrate the covariance edge case in dynamic method dispatch
  • demonstrate the use of runtime polymorphism in different scenarios
  • demonstrate ways of getting around name hiding
  • disable overriding and inheritance using the ‘final’ keyword
  • enable runtime polymorphism by marking destructors as virtual
  • explore the mechanics of runtime polymorphism
  • implement private inheritance
  • outline the concept of abstract classes
  • outline the concepts of multiple inheritance and the diamond hierarchy
  • perform dynamic casts
  • recall how private, public, and protected inheritance works
  • recall that default input arguments should not be specified in virtual functions
  • recall that the signatures of dynamically dispatched methods must be the same
  • recognize errors and issues which can result with dynamic casts
  • use C++-style static casts and contrast them with C-style casts
  • use ‘protected’ as the base class access specifier
  • use the scope resolution operator to invoke specific versions of virtual methods
  • use the ‘using’ keyword and implement virtual methods in multiple inheritance
  • work with copy constructors in inheritance hierarchies
  • work with destructors in inheritance hierarchies

RECENTLY ADDED COURSES