Static Data Members & Methods in C++ OOPS | C++ Tutorials for Beginners #24

Поделиться
HTML-код
  • Опубликовано: 1 мар 2020
  • Download the best IDE for C, C# and C++: bit.ly/WholeTomato-CWH
    ►Source Code & Resources: codewithharry.com/videos/cpp-...
    ►This video is a part of my C++ playlist: • C++ Tutorials In Hindi
    ►For Doubt Solving, Brain Storming Sessions & guaranteed replies, join the channel membership here: / @codewithharry
    ►Click here to subscribe - / @codewithharry
    ►Checkout my English channel here: / programmingwithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Python Tutorial In Hin...
    ►Python Complete Course In Hindi - • Python Tutorials For A...
    ►C Language Complete Course In Hindi -
    • C Language Tutorials I...
    ►JavaScript Complete Course In Hindi -
    • JavaScript Tutorials I...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Django Complete Course In Hindi -
    • Python Django Tutorial...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithharry.com
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

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

  • @shashijaiswal688
    @shashijaiswal688 3 года назад +258

    Static local variable = class variables
    Visibility: class
    Lifetime: till termination of program
    Default value:0
    Storage:heap
    Local Variable
    Visibility: class
    Lifetime: until execution of class
    Default value:garbage
    Storage:stack
    Global variable
    Visibility: file
    Lifetime: till termination of program
    Default value:0
    Storage:heap

  • @omkargunjal1611
    @omkargunjal1611 4 года назад +108

    Bhaiya data structures and algorithms pe bhi banado please, specially for competitive programming. Thanks a lot for your C and web development course, I learnt a lot from those

    • @dheerajaggarwal606
      @dheerajaggarwal606 2 года назад +11

      Bhai yar muje kuch smaj nahi aara h 😭 opps se please help kro 😭

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

      DS and algorithms pe bhi banao please

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

      @@dheerajaggarwal606 College mai ho ya nahi? Mujhe bhi difficulty ho rahi hai thodi si is topic pe.

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

      @@silverpenetrator739 hu 😭

    • @skybags365
      @skybags365 2 года назад +12

      @@dheerajaggarwal606 mujhe bhi nhi aa rha tha, fir maine Stephen Simon's ka oops in c++ in one video wala video dekha, waha se thoda basics clear kiya, fir geeksforgeeks pe jake thoda padha uske baad firse video number 21 is playlist ki start ki(is baar 2x pe dekha) , ab mujhe samajh aane laga hai, tum bhi try kar sakte ho, 1-2 din lagega max ye sab karne me.

  • @AshutoshKumar-fu6qe
    @AshutoshKumar-fu6qe 3 года назад +66

    I watch till very end to listen to the music. It's satisfying a lot.

  • @nikitabhosale51
    @nikitabhosale51 3 года назад +68

    This is very helpful course I like it. I just want to add one point in this, I saw ur c course, like this u can provide some small small exercise during this course. It's just for logic building. Otherwise overall it's great. I am learning so many things from you. Thank you.

  • @nithish_raina
    @nithish_raina 3 года назад +13

    Static data members are used to see the no of objects created and if the value is sequential then we came to know that.. Yes a common value is being shared and no of objects is returned. Static member functions are used to check the no of objects via static data members and also we can check whether the objects are created or not.

  • @harshkharwar9352
    @harshkharwar9352 4 года назад +18

    Thnx Harry sir.

  • @ritikabali6466
    @ritikabali6466 3 года назад +6

    so grateful to you sir for these videos.

  • @AshutoshKumar-fu6qe
    @AshutoshKumar-fu6qe 3 года назад +106

    11:52
    Two properties of static functions are:
    1> They can access static data members only
    2> They can run without making any object for the class

  • @indrajeetsinhdeval5955
    @indrajeetsinhdeval5955 3 года назад +4

    Every videos are awsm great help to my future Thank you so much👌👌👌👌👌

  • @salmanmohammed2770
    @salmanmohammed2770 2 года назад +11

    i came from udemy and i didnt understand oops there and then I saw your videos . now every topic is cemented . thanks for the good work;

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

      Udumy me Abdul Baari sir kaisa padhte he c++?

    • @nookalareshwanth1785
      @nookalareshwanth1785 6 месяцев назад +3

      bro didn't lose the habbit to use semicolon;

  • @atishayjain4452
    @atishayjain4452 2 года назад +7

    Harry bhai please put the question content also just like in C course

  • @mayankmaurya3521
    @mayankmaurya3521 3 года назад +9

    Great Video sir
    Really helpful

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

    Thank you Harry Bhai. This is very helpful for me.

  • @kamranaesthetics
    @kamranaesthetics 4 года назад +6

    Thanks Harry bhai!😊

  • @allfacts1331
    @allfacts1331 2 года назад +3

    Thank you so much Harry bhai for making this video 🌹☺️

  • @everymoment9422
    @everymoment9422 3 года назад +4

    Thanks sir your all video is very helpful

  • @kuldeepgngwr2096
    @kuldeepgngwr2096 4 года назад +3

    thank you so much sir ji.

  • @muskankushwah7062
    @muskankushwah7062 Год назад +17

    The course is really amazing , I am starting this course after learning python , for starting DSA in c++. The only thing that is missing in the course are exercises. But thankyou again for such an amazing course.

  • @csssatyamjadhav7681
    @csssatyamjadhav7681 3 года назад +1

    great work sir...Thanks for the video.. Harry bhai

  • @rawat_ji5183
    @rawat_ji5183 3 года назад +3

    dhanayawad harry bhiya

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

    Thanks aap bahot acche videos banate hai

  • @nehaakoli99
    @nehaakoli99 4 года назад +11

    Can u extend machine learning tutorial by explaining swarm intelligence ,ant colony algorithm??

  • @atharvpatharkar1652
    @atharvpatharkar1652 3 года назад +2

    Thank You 🙏🏻

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

    Thanks Harry Bhaiya

  • @MuhammadAkmal-ww1vt
    @MuhammadAkmal-ww1vt 2 года назад +2

    This playlist is very helpful

  • @ustadsandeepmaheshwari2913
    @ustadsandeepmaheshwari2913 4 года назад +2

    Harry bhai your videos series is outstanding

  • @Voyager_Plays
    @Voyager_Plays 3 года назад +8

    SIr aap tier 3 collage students ka bhavan ho🙏🙏🙏 Thanks for your effort to change Indian education system i always share your playlist to all my friends

  • @Priya-hr5si
    @Priya-hr5si 3 года назад +3

    Very good explain sir

  • @PriyankaPatel-gx3pj
    @PriyankaPatel-gx3pj 3 года назад +3

    Sir you are doing grear job

  • @codewithgagan
    @codewithgagan 4 года назад +7

    I waiting this video 😀😀

  • @mohitchouhan7679
    @mohitchouhan7679 5 месяцев назад +1

    very useful content and easy to understand

  • @Techny
    @Techny 4 года назад +5

    bro amaazzzziiiing course!!!!!!!

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

    ahhh Thank you, Harry bhai!

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

    Sir apka samjhane ka tarika best hai

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

    Thankyou sir ji

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

    Greatt!!!👍👍👍

  • @susilrajneupane1745
    @susilrajneupane1745 3 года назад +1

    Thank you bhai :) :)

  • @muhammadtayyab6721
    @muhammadtayyab6721 9 месяцев назад +2

    1:17 Static data member
    11:09 Static member function

  • @kvkv2856
    @kvkv2856 3 года назад +1

    Thank you bhaiya❤️

  • @KK-hd4wy
    @KK-hd4wy 8 месяцев назад

    Really learned a lot

  • @jitendra503
    @jitendra503 4 года назад +2

    Thanks

  • @shantanusingh2039
    @shantanusingh2039 Год назад +6

    The only loophole is the videos are too short , with not very much examples/exercises :)

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

    awesome tutorial sir

  • @AhmedRaza-ty7zq
    @AhmedRaza-ty7zq 9 месяцев назад +1

    Awesome video😎😎👍👍

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

    Thank you sir

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

    thank you so much bro

  • @codenamedangerozone4050
    @codenamedangerozone4050 3 года назад

    Thank you

  • @siddhibhalekar9477
    @siddhibhalekar9477 2 года назад +23

    Hey harry,
    This playlist is too confusing even though I have completed your c language course because of too lengthy programs as an example also you made written notes for c it was so useful for me during exams for concept learning....🧡🧡🧡

    • @petsgestures
      @petsgestures 11 месяцев назад +2

      yep you are exactly right.....He uses very tough example for code to understand us...but these tough examples create very confusions

    • @PriyanshuSingh-ky8jt
      @PriyanshuSingh-ky8jt 19 дней назад

      @@petsgestures lol you guys don't have coder minset so leave it

  • @dharmendrachauhan3640
    @dharmendrachauhan3640 3 года назад

    soo, nice harry bhai

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

    sir apka video dek kar 90% clear hota hai , orr baki 10% joki question reheta hai jiska ans nehi milta

  • @theuntitled2730
    @theuntitled2730 10 месяцев назад

    thank you harry bhai

  • @nilmanitiwari6611
    @nilmanitiwari6611 Год назад +2

    Sir, please add some questions between the video because I am beginner and don't have any experience that how to approach questions...

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

    Harry Bhaiya you teahing is osm...

  • @technicalutkranti
    @technicalutkranti 2 года назад +9

    Thanks a ton Harry for such an informative video. I have two questions on this video.
    1. Why is it required to declare the static variable outside of the class with scope resolution operator and inside to specify its static property ? Can't we do it in one go.
    2. Why static functions can only access static members of the class ?

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

      1. I think to allot memory beforehand (not sure about this one)
      2. Because other member functions (say int id) are property of object, i.e. they will have different values for each object. ( like id of harry is 1, rohan is 2 ...)

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

      Q2 ans: because static functions are props of class not object.
      They are shared by class. So it just can access static members (also class property)

  • @techlopediahindi7988
    @techlopediahindi7988 4 года назад +17

    Hey pls make a playlist on ethical hackimg course

  • @nikhilraj1842
    @nikhilraj1842 4 года назад +5

    Harry bhai ham n dimensional vector kaise bana sakte hae cpp me

  • @self-mentoring6657
    @self-mentoring6657 3 года назад +31

    sir?
    Will you be adding the videos on STL in c++ in this playlist?

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

    Thankyou Harry Bhaiya

  • @sudhakarsahu344
    @sudhakarsahu344 3 года назад +5

    cout

  • @abcefg7045
    @abcefg7045 3 года назад +6

    2 properties of static function are
    1. they run without objects, with the class name and resolution operator
    2. they can access static data members, only

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

      they can access static data functions too bro

  • @mightyasjed
    @mightyasjed 3 года назад +7

    ending music is awesome harry bhai you are one of the peoples who are changing the future love from pakistan

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

    Thanks bhai

  • @mohammadmohsinmohammedmohs9717
    @mohammadmohsinmohammedmohs9717 3 года назад +6

    HEY how to get object name in runtime?

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

    thanks harry bro

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

    Thank youuuuu

  • @cr7johnChan
    @cr7johnChan 2 года назад +3

    Static functions do not need any object to run
    Static functions can access only static variables

  • @ahirjatin5418
    @ahirjatin5418 3 года назад

    Thnx Harry sir

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

    Harry bhai you are the best❤️

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

    I just got essence of it after changing variable to 1000!

  • @harshshukla3978
    @harshshukla3978 2 года назад +4

    Do we use static variable only in class?

  • @natt5chanel583
    @natt5chanel583 3 года назад +2

    Can we use global in this instead of static

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

    Datastructure and algorithm

  • @JenilMendpara
    @JenilMendpara Год назад +3

    Videos Number #23
    31-12-2022
    05 : 57 PM
    // Array in class
    #include
    using namespace std;
    class Student
    {
    private:
    int RollNo[10];
    int Marks[10];
    int n;
    public:
    void getData(void);
    void Display(void);
    void Count(void)
    {
    cout n;
    }
    };
    void Student ::getData(void)
    {
    Count();
    for (int i = 0; i < n; i++)
    {
    cout

  • @shashijaiswal688
    @shashijaiswal688 3 года назад +12

    Static variables are class variables.
    Every object of class have its own copy of variables but im case of static variables... Value of static variable is not different for different objects.

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

      absolutely right my dear.hv u completed your cpp learning?

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

      @@md_asharaf tharki bc xD

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

    Harry bhai django ke follow unfollow models par bhi video bna do

  • @n.lsharma8751
    @n.lsharma8751 Год назад +1

    Sir aapne itni mehnat ki hai ,sir thodi or mehnat karke sir aapko Ed do question karvane chahiye the

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

    Data structures or algorithms pe bhi video banao bhaiya

  • @Mustafaali-e7o
    @Mustafaali-e7o 5 месяцев назад

    nice

  • @jokestudio15
    @jokestudio15 Год назад +2

    Static variable ~ class variables

  • @rnikhilkumar9371
    @rnikhilkumar9371 2 года назад +3

    Why static function allows itself to define it inside of class but static datatype doesn't?

  • @rishunandan4725
    @rishunandan4725 3 года назад +7

    Write a program to add two vectors. A vector in 3D can be represented as v=ai+bj+ck. The
    initial value when a vector is created will be 0i+0j+0k. Use the name of class as vector. There will
    be three functions one for input, for sum and for display.
    Sir .....

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

    Scope resolution operator kis video mn explain kia hua hai?

  • @Shivam-ed5fn
    @Shivam-ed5fn 3 года назад

    Ek game development pr bhi playlist bna dijye sir....Please

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

    Sir i tried a new thing if you will not initialize count with 0 then, by simply writing it as (int count; ) then it will also work....

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

    agar static ke vajaye (return count ) kar de toh ye chal sakta hai kya

  • @abhijaysaraswat83
    @abhijaysaraswat83 3 года назад +11

    can a static function be defined outside the class using scope resolution operator'::'.what if we only create the prortotype or declaration of the static function inside the class like we do with other normal functions?

    • @rickk3300
      @rickk3300 3 года назад +2

      Try it in your IDE, and check whether it works or not.

    • @arnab_mandal_01
      @arnab_mandal_01 3 года назад +1

      @@rickk3300 working bro

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

      @@arnab_mandal_01 can u send me how u wrote the prototype inside class and the the function outside class using scope resolution

    • @pratikkadam540
      @pratikkadam540 2 года назад +3

      Hey bro it's working 😅

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

      @@pratikkadam540 ✌🏻😊

  • @sheshanksidheshwar9846
    @sheshanksidheshwar9846 Год назад +4

    sir agar hum int count ko globally declare kare means after namespace std then also its showing the same result....when we used static variable.?

    • @timepassscript
      @timepassscript Год назад +2

      If you would do that then basic meaning of encapsulation is gone, the properties and methods of a particular function should reside inside the same class.
      Here count is property of class so it should only be accessible to class not to the entire codebase.

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

    Sir please ap hamain har video ke sath koi practice task bhi de diya karain .....! thanks

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

    Can I use static in setdata and getdata

  • @Cyber_pk320
    @Cyber_pk320 11 месяцев назад +1

    Harry bhaiya ...kya dynamic memory allocation yahi hai??

  • @dipesh-singla
    @dipesh-singla 4 года назад +1

    Analytic way mein samjhao please

  • @tahirummati4503
    @tahirummati4503 8 месяцев назад +1

    But if we run setdata on harry again the count will change. And in this way we may have a logical error as the number of objects is remaining the same rather we r using the method again on some previous object to change the ID but i will again change the count as well and the count will be greater than the objects ....

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

    sir aap har video k sath notes available kra dete to kafi accha rehta kuki aap ki kahi sari batein nhi note kr pata hu

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

    In my college I have to face huge problem of language because all the lectures are taken in Gujarati language
    This man help me

  • @aakashvavadiya1465
    @aakashvavadiya1465 4 года назад +2

    Sir java par tutorial kab aayega ??

  • @barberrionking453
    @barberrionking453 3 года назад +3

    ❤️❤️❤️

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

    Bhai plzz atock market ki algorithms banane ki series bana do plzz plzz bhai request kubool kro 🙏🙏🙏

  • @dipanshsaxena5192
    @dipanshsaxena5192 3 года назад +2

    Summary on 14:52

  • @Yash-wf5lg
    @Yash-wf5lg 2 года назад +2

    Static function ke initialize kyu nahi kara outside the function aur agar usme count phele se hi static tha toa function ko static krene ki zarurat kyu thi?

  • @RahulSaini-pp5kz
    @RahulSaini-pp5kz 2 года назад +1

    13.57
    How is he moving lines up and down