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

Sdílet
Vložit
  • čas přidán 1. 03. 2020
  • ►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

Komentáře • 326

  • @shashijaiswal688
    @shashijaiswal688 Před 3 lety +254

    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

  • @AshutoshKumar-fu6qe
    @AshutoshKumar-fu6qe Před 3 lety +103

    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

  • @AshutoshKumar-fu6qe
    @AshutoshKumar-fu6qe Před 3 lety +64

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

  • @omkargunjal1611
    @omkargunjal1611 Před 4 lety +105

    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 Před 2 lety +11

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

    • @Ramdut369
      @Ramdut369 Před 2 lety +2

      DS and algorithms pe bhi banao please

    • @silverpenetrator739
      @silverpenetrator739 Před 2 lety +2

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

    • @dheerajaggarwal606
      @dheerajaggarwal606 Před 2 lety +1

      @@silverpenetrator739 hu 😭

    • @skybags365
      @skybags365 Před 2 lety +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.

  • @nikitabhosale51
    @nikitabhosale51 Před 3 lety +67

    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 Před 3 lety +11

    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 Před 4 lety +18

    Thnx Harry sir.

  • @ritikabali6466
    @ritikabali6466 Před 3 lety +6

    so grateful to you sir for these videos.

  • @indrajeetsinhdeval5955
    @indrajeetsinhdeval5955 Před 3 lety +4

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

  • @salmanmohammed2770
    @salmanmohammed2770 Před 2 lety +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 Před rokem

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

    • @nookalareshwanth1785
      @nookalareshwanth1785 Před 5 měsíci +3

      bro didn't lose the habbit to use semicolon;

  • @mayankmaurya3521
    @mayankmaurya3521 Před 3 lety +9

    Great Video sir
    Really helpful

  • @atishayjain4452
    @atishayjain4452 Před 2 lety +7

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

  • @mohsinabbas9464
    @mohsinabbas9464 Před 2 lety +2

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

  • @kuldeepgngwr2096
    @kuldeepgngwr2096 Před 4 lety +3

    thank you so much sir ji.

  • @allfacts1331
    @allfacts1331 Před 2 lety +3

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

  • @kamranaesthetics
    @kamranaesthetics Před 4 lety +6

    Thanks Harry bhai!😊

  • @atharvpatharkar1652
    @atharvpatharkar1652 Před 3 lety +2

    Thank You 🙏🏻

  • @csssatyamjadhav7681
    @csssatyamjadhav7681 Před 3 lety +1

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

  • @MuhammadAkmal-ww1vt
    @MuhammadAkmal-ww1vt Před 2 lety +2

    This playlist is very helpful

  • @JenilMendpara
    @JenilMendpara Před rokem +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

  • @muskankushwah7062
    @muskankushwah7062 Před rokem +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.

  • @ustadsandeepmaheshwari2913

    Thanks aap bahot acche videos banate hai

  • @ustadsandeepmaheshwari2913

    Harry bhai your videos series is outstanding

  • @royfamily9273
    @royfamily9273 Před 2 lety +1

    Thanks Harry Bhaiya

  • @PriyankaPatel-gx3pj
    @PriyankaPatel-gx3pj Před 3 lety +3

    Sir you are doing grear job

  • @Priya-hr5si
    @Priya-hr5si Před 3 lety +3

    Very good explain sir

  • @muhammadareebkazmi9476

    ahhh Thank you, Harry bhai!

  • @muhammadtayyab6721
    @muhammadtayyab6721 Před 9 měsíci +2

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

  • @everymoment9422
    @everymoment9422 Před 3 lety +4

    Thanks sir your all video is very helpful

  • @mohitchouhan7679
    @mohitchouhan7679 Před 4 měsíci +1

    very useful content and easy to understand

  • @akapkaapnacomady7228
    @akapkaapnacomady7228 Před 2 lety

    Sir apka samjhane ka tarika best hai

  • @kvkv2856
    @kvkv2856 Před 3 lety +1

    Thank you bhaiya❤️

  • @Voyager_Plays
    @Voyager_Plays Před 3 lety +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

  • @rawat_ji5183
    @rawat_ji5183 Před 3 lety +3

    dhanayawad harry bhiya

  • @codewithgagan
    @codewithgagan Před 4 lety +1

    Thankyou sir ji

  • @susilrajneupane1745
    @susilrajneupane1745 Před 3 lety +1

    Thank you bhai :) :)

  • @jitendra503
    @jitendra503 Před 4 lety +2

    Thanks

  • @Techny
    @Techny Před 4 lety +5

    bro amaazzzziiiing course!!!!!!!

  • @TopG776
    @TopG776 Před rokem

    Thank you sir

  • @KK-hd4wy
    @KK-hd4wy Před 7 měsíci

    Really learned a lot

  • @codenamedangerozone4050

    Thank you

  • @sudhakarsahu344
    @sudhakarsahu344 Před 3 lety +5

    cout

  • @nehalsingh785
    @nehalsingh785 Před 2 lety +1

    awesome tutorial sir

  • @nehaakoli99
    @nehaakoli99 Před 4 lety +11

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

  • @codewithgagan
    @codewithgagan Před 4 lety +7

    I waiting this video 😀😀

  • @simranbains6199
    @simranbains6199 Před rokem

    thank you so much bro

  • @mohinishendye1040
    @mohinishendye1040 Před 2 lety +1

    Greatt!!!👍👍👍

  • @siddhibhalekar9477
    @siddhibhalekar9477 Před 2 lety +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 Před 10 měsíci +2

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

  • @twi4458
    @twi4458 Před 2 lety

    Thankyou Harry Bhaiya

  • @theuntitled2730
    @theuntitled2730 Před 9 měsíci

    thank you harry bhai

  • @dharmendrachauhan3640
    @dharmendrachauhan3640 Před 3 lety

    soo, nice harry bhai

  • @AhmedRaza-ty7zq
    @AhmedRaza-ty7zq Před 8 měsíci +1

    Awesome video😎😎👍👍

  • @dangerouscoder6057
    @dangerouscoder6057 Před 2 lety +2

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

  • @batboltalk7729
    @batboltalk7729 Před 4 lety

    Thanks bhai

  • @nilmanitiwari6611
    @nilmanitiwari6611 Před rokem +2

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

  • @chaolobi7698
    @chaolobi7698 Před 2 lety

    thanks harry bro

  • @mightyasjed
    @mightyasjed Před 3 lety +7

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

  • @sagarvlogs7707
    @sagarvlogs7707 Před 2 lety

    Harry Bhaiya you teahing is osm...

  • @shantanusingh2039
    @shantanusingh2039 Před rokem +6

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

  • @apurvasonawane5049
    @apurvasonawane5049 Před 2 lety

    Thank youuuuu

  • @abcefg7045
    @abcefg7045 Před 3 lety +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 Před 2 lety

      they can access static data functions too bro

  • @technicalutkranti
    @technicalutkranti Před 2 lety +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 Před rokem +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 Před rokem

      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)

  • @ahirjatin5418
    @ahirjatin5418 Před 3 lety

    Thnx Harry sir

  • @rishunandan4725
    @rishunandan4725 Před 3 lety +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 .....

  • @jokestudio15
    @jokestudio15 Před rokem +2

    Static variable ~ class variables

  • @cr7johnChan
    @cr7johnChan Před 2 lety +3

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

  • @dreamerb1
    @dreamerb1 Před rokem

    Harry bhai you are the best❤️

  • @Gurps7
    @Gurps7 Před 2 lety

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

  • @himanish2006
    @himanish2006 Před 4 lety +1

    Datastructure and algorithm

  • @shashijaiswal688
    @shashijaiswal688 Před 3 lety +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.

  • @techlopediahindi7988
    @techlopediahindi7988 Před 4 lety +17

    Hey pls make a playlist on ethical hackimg course

  • @Mustafaali-e7o
    @Mustafaali-e7o Před 4 měsíci

    nice

  • @dipanshsaxena5192
    @dipanshsaxena5192 Před 3 lety +2

    Summary on 14:52

  • @n.lsharma8751
    @n.lsharma8751 Před 11 měsíci +1

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

  • @harshsingh2289
    @harshsingh2289 Před rokem +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....

  • @self-mentoring6657
    @self-mentoring6657 Před 3 lety +31

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

  • @Ramdut369
    @Ramdut369 Před 2 lety +1

    Data structures or algorithms pe bhi video banao bhaiya

  • @Shivam-ed5fn
    @Shivam-ed5fn Před 3 lety

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

  • @harshshukla3978
    @harshshukla3978 Před 2 lety +4

    Do we use static variable only in class?

  • @mohammadmohsinmohammedmohs9717

    HEY how to get object name in runtime?

  • @rnikhilkumar9371
    @rnikhilkumar9371 Před 2 lety +3

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

  • @techlearnwithsharmaji3204

    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 Před rokem +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

  • @dipesh-singla
    @dipesh-singla Před 4 lety +1

    Analytic way mein samjhao please

  • @nikhilraj1842
    @nikhilraj1842 Před 4 lety +5

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

  • @tahirummati4503
    @tahirummati4503 Před 8 měsíci +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 ....

  • @samyakbharsakle7283
    @samyakbharsakle7283 Před 6 měsíci

    cfbr good stuff

  • @ygpointoffun9418
    @ygpointoffun9418 Před rokem +18

    it is too confusing

    • @harshhitgupta4434
      @harshhitgupta4434 Před 7 dny +1

      Confusing nhi interesting ek baar samajhke dekho bhai .....mujhe tumpe vishwaas hai tum kar sakte ho....jee jaan laga do and Jeet jao iss baar

    • @graviton001
      @graviton001 Před 2 dny

      ​@@harshhitgupta4434 yeah its interesting. And I suggest to watch c before c ++ bcz its kind of cakewalk after learning c😊

  • @PrinceUpadhyayneeraj
    @PrinceUpadhyayneeraj Před 4 lety +1

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

  • @natt5chanel583
    @natt5chanel583 Před 3 lety +2

    Can we use global in this instead of static

  • @skymusic0_9
    @skymusic0_9 Před rokem

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

  • @Cyber_pk320
    @Cyber_pk320 Před 11 měsíci +1

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

  • @victorb22622
    @victorb22622 Před 2 měsíci

    5:09 x static vatiable को आप क्लास के अंदर नही बाहर लिख सकते है। 5:54 में फिर से static int count class के अंदर ही लिखा।

    • @keshav8269
      @keshav8269 Před 27 dny

      Declare andar karna hota ha
      Bahar likh ka usa memeory milti ha mtlb memory allocate hoti ha
      Aur initialise bhi bahar karni padti ha ,

  • @sohaasif1385
    @sohaasif1385 Před 2 lety +1

    Scope resolution operator kis video mn explain kia hua hai?

  • @statusstrategy7292
    @statusstrategy7292 Před rokem +3

    Sir app samjate to accha ho per notes banane me problem ho Rahi hai app sab mix kar dete ho kuch bhi baad me samaj nahi atta

  • @prathameshyadav2001
    @prathameshyadav2001 Před 3 lety

    6:30 have to declare ststic variables outside of class
    these are by default initialized at 0

  • @sheshanksidheshwar9846
    @sheshanksidheshwar9846 Před rokem +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 Před rokem +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.

  • @kumkumbhagya51
    @kumkumbhagya51 Před rokem

    7:57 ohh ab samajh aaya static ka fayeda hai default value zero hogi isliye bina set kiye correct numbering milegi aur static use na kiya aur fir set kiye bina chalayenge to garbage value milegi

  • @tradingkeeda5575
    @tradingkeeda5575 Před 4 lety

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

  • @barberrionking453
    @barberrionking453 Před 3 lety +3

    ❤️❤️❤️