Advanced C++: Inheritance - Public, Protected, and Private

Поделиться
HTML-код
  • Опубликовано: 29 ноя 2024
  • The meaning and usage of the 3 types of inheritance.
    Notes can be downloaded from: boqian.weebly.com

Комментарии • 23

  • @ultrabouiuc
    @ultrabouiuc 11 лет назад +1

    I like the old guy appeared at the end of the video; makes me happy!
    very clear explanation and good examples!!

  • @aayushneupane5211
    @aayushneupane5211 4 года назад

    A derived class doesn't inherit access to private data members. However, it does inherit a full parent object, which contains any private members which that class declares.

  • @AJAYSHARMA-gb6qw
    @AJAYSHARMA-gb6qw 7 лет назад +1

    nice effort friend you resolved the problem in just a few minutes thanks alot

  • @Hezyo922
    @Hezyo922 5 лет назад

    Great explanation, great way of narration too

  • @samarthmistry3625
    @samarthmistry3625 4 года назад +1

    This video gotta great secret point.
    Thank you!

  • @katlegomatjila6130
    @katlegomatjila6130 7 лет назад +1

    Your tutorials are le best.

  • @PabitraPadhy
    @PabitraPadhy 2 года назад

    Last 3 mins is a bit confusing. When the jump happens to composition vs. private inheritance.
    I understand both concepts individually, but couldn't connect the dots Bo is explaining. If someone understands it clearly, do help me in the comment thread.

  • @eddanapudir
    @eddanapudir 8 лет назад

    Hi Bo, Thanks for the video. Could you please explain why cannot I cast D2 to pB. and why this is not 'isa' relationship. I understand D2 is 'protected inheritance', that still has public and protected members of B are protected members of D2. Thanks

  • @digimikeh
    @digimikeh 4 года назад

    excuse me, did you mean virtual void function_name more than virtual function_name ?
    Thanks..

  • @SeaHorseIsFlying
    @SeaHorseIsFlying 7 лет назад

    Since D_prot D2 is protected of B, why D2.f_pub() is illegal? I thought it could be operated since it is protected and can be derived from the parent class with a public function? Thanks.

    • @bluehornet6752
      @bluehornet6752 7 лет назад +1

      Because the base class public and protected member functions get inherited by the base class as protected member functions, and are therefore not able to be called outside of the class...or one of its children. And the main() function doesn't meet either of those two criteria.

    • @SeaHorseIsFlying
      @SeaHorseIsFlying 7 лет назад

      Thank you. :-)

    • @bluehornet6752
      @bluehornet6752 7 лет назад

      No sweat.

  • @laysauchoa7557
    @laysauchoa7557 10 лет назад

    THANK YOU SO MUCH!

  • @konstantinrebrov675
    @konstantinrebrov675 6 лет назад

    Good lecture!

  • @SAURAV1403406SAXENA
    @SAURAV1403406SAXENA 6 лет назад

    In class Dog ring_m defaults to what public??

    • @digimikeh
      @digimikeh 4 года назад

      as Peterolen said,
      class default is private
      struct default is public..

  • @hyanhyan-bf1dx
    @hyanhyan-bf1dx 6 лет назад

    What do you mean by a class's friend?

    • @digimikeh
      @digimikeh 4 года назад

      friend is a special object type that can access private members of a class...

  • @6183134
    @6183134 7 лет назад

    At least how to Inheritance protected! Thanks!

  • @mica122213
    @mica122213 10 лет назад

    creamofsomeyoungguy?