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
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
thanks bro
Sooo much thanks bro
Thanks bro
🎉
very good bro thanks
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
Bhai yar muje kuch smaj nahi aara h 😭 opps se please help kro 😭
DS and algorithms pe bhi banao please
@@dheerajaggarwal606 College mai ho ya nahi? Mujhe bhi difficulty ho rahi hai thodi si is topic pe.
@@silverpenetrator739 hu 😭
@@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.
I watch till very end to listen to the music. It's satisfying a lot.
Same here bro 🤣
😂same here
Same lol
You can directly skip the video till end, don't waste your time
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.
OK Agli baar se ho jaega sayad
@@manishkasera8584 ho gya kya ?
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.
Thnx Harry sir.
so grateful to you sir for these videos.
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
Edit the first one : add "only " after access
@@hwaiting3573 Thanks
@@AshutoshKumar-fu6qe No problem
👍👍
absolutely correct 👍👍
Every videos are awsm great help to my future Thank you so much👌👌👌👌👌
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;
Udumy me Abdul Baari sir kaisa padhte he c++?
bro didn't lose the habbit to use semicolon;
Harry bhai please put the question content also just like in C course
Great Video sir
Really helpful
Thank you Harry Bhai. This is very helpful for me.
Thanks Harry bhai!😊
Thank you so much Harry bhai for making this video 🌹☺️
Thanks sir your all video is very helpful
thank you so much sir ji.
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.
hey even I started c++ and about to start DSA would you like to group study with me online?
post jee?
@@tanishbajaj4952 what?
@@chiragparmar1964 i am in , where can i contact you
@@chiragparmar1964 nei degi bhai...
great work sir...Thanks for the video.. Harry bhai
dhanayawad harry bhiya
Thanks aap bahot acche videos banate hai
Can u extend machine learning tutorial by explaining swarm intelligence ,ant colony algorithm??
Thank You 🙏🏻
Thanks Harry Bhaiya
This playlist is very helpful
Harry bhai your videos series is outstanding
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
Very good explain sir
Sir you are doing grear job
I waiting this video 😀😀
very useful content and easy to understand
bro amaazzzziiiing course!!!!!!!
ahhh Thank you, Harry bhai!
Sir apka samjhane ka tarika best hai
Thankyou sir ji
Greatt!!!👍👍👍
Thank you bhai :) :)
1:17 Static data member
11:09 Static member function
Thank you bhaiya❤️
Really learned a lot
Thanks
The only loophole is the videos are too short , with not very much examples/exercises :)
awesome tutorial sir
Awesome video😎😎👍👍
Thank you sir
thank you so much bro
Thank you
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....🧡🧡🧡
yep you are exactly right.....He uses very tough example for code to understand us...but these tough examples create very confusions
@@petsgestures lol you guys don't have coder minset so leave it
soo, nice harry bhai
sir apka video dek kar 90% clear hota hai , orr baki 10% joki question reheta hai jiska ans nehi milta
thank you harry bhai
Sir, please add some questions between the video because I am beginner and don't have any experience that how to approach questions...
Harry Bhaiya you teahing is osm...
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 ?
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 ...)
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)
Hey pls make a playlist on ethical hackimg course
Yes, Do!
+++
Harry bhai ham n dimensional vector kaise bana sakte hae cpp me
sir?
Will you be adding the videos on STL in c++ in this playlist?
kr dega to chaar chand lg jaega
@@manishkasera8584 kr diya add
Thankyou Harry Bhaiya
cout
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
they can access static data functions too bro
ending music is awesome harry bhai you are one of the peoples who are changing the future love from pakistan
Thanks bhai
HEY how to get object name in runtime?
thanks harry bro
Thank youuuuu
Static functions do not need any object to run
Static functions can access only static variables
Thnx Harry sir
Harry bhai you are the best❤️
I just got essence of it after changing variable to 1000!
Do we use static variable only in class?
Can we use global in this instead of static
Datastructure and algorithm
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
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.
absolutely right my dear.hv u completed your cpp learning?
@@md_asharaf tharki bc xD
Harry bhai django ke follow unfollow models par bhi video bna do
Sir aapne itni mehnat ki hai ,sir thodi or mehnat karke sir aapko Ed do question karvane chahiye the
Data structures or algorithms pe bhi video banao bhaiya
nice
Static variable ~ class variables
Why static function allows itself to define it inside of class but static datatype doesn't?
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 .....
ans>
Jaise complex ka kiya tha waise he isko bhi karna hai
They both are similar
Scope resolution operator kis video mn explain kia hua hai?
Ek game development pr bhi playlist bna dijye sir....Please
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....
agar static ke vajaye (return count ) kar de toh ye chal sakta hai kya
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?
Try it in your IDE, and check whether it works or not.
@@rickk3300 working bro
@@arnab_mandal_01 can u send me how u wrote the prototype inside class and the the function outside class using scope resolution
Hey bro it's working 😅
@@pratikkadam540 ✌🏻😊
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.?
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.
Sir please ap hamain har video ke sath koi practice task bhi de diya karain .....! thanks
Can I use static in setdata and getdata
Harry bhaiya ...kya dynamic memory allocation yahi hai??
Analytic way mein samjhao please
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 ....
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
Notes discription mai hote hai bro
In my college I have to face huge problem of language because all the lectures are taken in Gujarati language
This man help me
Sir java par tutorial kab aayega ??
❤️❤️❤️
Bhai plzz atock market ki algorithms banane ki series bana do plzz plzz bhai request kubool kro 🙏🙏🙏
Summary on 14:52
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?
13.57
How is he moving lines up and down