📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      Which of the following prevents inheritance in

      C++?
      A Final class Correct Answer Incorrect Answer
      B Abstract base class Correct Answer Incorrect Answer
      C Protected constructor Correct Answer Incorrect Answer
      D Private inheritance Correct Answer Incorrect Answer
      E Declaring the class as final using = delete Correct Answer Incorrect Answer

      Solution

      In C++, marking a class final (since C++11) using = delete can prevent inheritance by making the derived constructor inaccessible.

      Practice Next
      ask-question