Static Member Functions | C++ Tutorial

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024

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

  • @_Rodrigues-jc3nf
    @_Rodrigues-jc3nf 4 месяца назад +1

    I sure as hell that i will recomend you to my friends. I wish that you could be my professor!!!!! :)

  • @Huffer7
    @Huffer7 Год назад +1

    Very well explained!

  • @dzentsetsu5607
    @dzentsetsu5607 2 года назад +1

    Thank you for good tutorial. Have a question. Where is it okay to initialize static variable? Should it be initialized in header or cpp file? And another question is it considered bad practice to make static variable public?

    • @PortfolioCourses
      @PortfolioCourses  2 года назад +2

      You're welcome! And great questions too! 🙂 We shouldn't initialize the static variable in the header, this is a good thread as to why: stackoverflow.com/questions/22869788/why-should-i-not-initialize-static-variable-in-header. I've never heard that it's a bad practice to make static variables public, I think it would depend on what they are being used for.

    • @dzentsetsu5607
      @dzentsetsu5607 2 года назад +1

      @@PortfolioCourses 🙏🙏🙏

  • @stonedcodingtom9097
    @stonedcodingtom9097 Год назад +1

    Very good explanation

    • @PortfolioCourses
      @PortfolioCourses  Год назад

      Thank you very much for the positive feedback, I'm glad you enjoyed the explanation! :-)

  • @ValliNayagamChokkalingam
    @ValliNayagamChokkalingam Год назад

    Thank you! Private variables cannot be defined/initialized outside the class but private static variables can be initialized outside the class using ::, right?

    • @PortfolioCourses
      @PortfolioCourses  Год назад

      Yes that's true, though I believe private static variables *must* be initialized outside of the class (though if you really deep drive research it you may find there is some nuance there, I think a couple types of static members can be technically be initialized in the class).

  • @nejatakar7641
    @nejatakar7641 Год назад

    You guys are the best !!!