InheritancePart V (Lecture 40)

Поділитися
Вставка
  • Опубліковано 15 гру 2024

КОМЕНТАРІ • 2

  • @manmohankrishna2407
    @manmohankrishna2407 5 років тому +5

    the code at 20:53 gives the following error:
    error:'C::C()' is protected
    similar thing for the destructor of C.
    Also, there's no such error for the constructor and destructor of B although they are also protected.

    • @manmohankrishna2407
      @manmohankrishna2407 5 років тому +3

      I understood later. The error is due to the creation of C data_ in D which is not allowed since constructor of C is protected which D can access only for creating an instance of D. Further can be clarified if you delete "C data_;" and try to run the code and see the output.