InheritancePart V (Lecture 40)

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 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.