Static Data Members in C++ & Static Member Functions in C++|C++ programming tutorials for Beginners
HTML-код
- Опубликовано: 25 июл 2024
- Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
--------------------------------------------------------------------------------------------- In this video tutorial we will understand the concept of static data members in c++ and static member functions in c++.
Static Data members in C++_
A static member is shared by all objects of the class.
All static data is initialized to zero when the first object is created, if no other initialization is present.
We can't put it in the class definition but it can be initialized outside the class using the scope resolution operator :: to identify which class it belongs to.
When we declare a member of a class as static it means no matter how many objects of the class are created, there is only one copy of the static member.
Static Member functions in C++
By declaring a member function as static, you make it independent of any particular object of the class. A static member function can be called even if no objects of the class exist and the static functions are accessed using only the class name and the scope resolution operator (::)
A static member function can only access static data member, other static member functions and any other functions from outside the class.
Static member functions have a class scope and they do not have access to the this pointer of the class.
You could use a static member function to determine whether some objects of the class have been created or not.
Static Members & Member Functions in C++ Theory Article - simplesnippets.tech/static-me...
Download Dev C++ IDE : sourceforge.net/projects/orwe...
Download C++ Android App : play.google.com/store/apps/de...
Simple Snippets Official Website -
simplesnippets.tech/
Simple Snippets on Facebook-
/ simplesnippets
Simple Snippets on Instagram-
/ simplesnipp. .
Simple Snippets Google Plus Page-
plus.google.com/+SimpleSnippets
Simple Snippets email ID-
simplesnippetsinfo@gmail.com
For Classroom Coaching in Mumbai for Programming & other IT/CS Subjects Checkout UpSkill Infotech - upskill.tech/
UpSkill is an Ed-Tech Company / Coaching Centre for Information Technology / Computer Science oriented courses and offer coacing for various Degree courses like BSc.IT, BSc.CS, BCA, MSc.IT, MSc.CS, MCA etc.
Contact via email /call / FB /Whatsapp for more info
email - upskillinfotech@gmail.com
We also Provide Certification courses like -
Android Development
Web Development
Java Developer Course
.NET Developer Course
Check us out on Social media platforms like Facebook, Instagram, Google etc
Facebook page - / upskillinfotech
Insta page - / upskill_infotech
Google Maps - goo.gl/maps/vjNtZazLzW82
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌
Sorry to be so off topic but does anyone know of a tool to get back into an instagram account??
I was dumb lost my password. I appreciate any tips you can give me
Very young and experienced teacher...🙃🙃🙃
Thank you buddy, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌️
No words ! Thanks a lot 😇
I watch this video 2 times , now I understand very well, all my doubts have cleared, Thank you so much
your videos were really helpful for my practical exam on one day before thanks
Thank you so much Om😇. Very happy to hear this from you. Please do share the videos with your friends too 🙏 it'll be very helpful 😇
You are awesome you are great!! And the thing you are doing is very kind from.your side really man I easily understood this!!!
Most welcome aditya 😊 I'm very glad to hear this from you bro. I would request you to please share this video with your friends too buddy. That's the biggest help and support for our channel 🤟😊
thanks for this playlist
Loved it!
All doubts are cleared thanx
your video is embedded in Chandigarh University course material, Kudos!
Wow I'm glad to know this🤟 would love it if you could share a link so that I can check it out😊
great explanation thanks
Ur way of explaining is awesome and really helpful.. Keep uploading more such videos..
Hello Mansi, thank you so much for such a wonderful feedback 😇😊
And yes I'll keep making many more such educational content ✌️
I would request you to please share the videos with your friends and contacts 😇✌️ that'll be the best help and support for everyone 😊
Thanks🎉
Can u give an example of static data members and member functions without using constructors
Is there any need of declaring the int x in the program..? Because I did not find a reason to declare it...can you pls explain?
Jenny's lectures and simple snippets ❤️❤️ONE OF THE WAY TO LEARN AND UNDERSTAND CONCEPTS ❤️
You are helping very much to many students
Thank you so much Satish, this really makes me very happy that I'm able to contribute and share my knowledge with so many people ✌️🙏
Keep sharing and keep up the support ❤️
Sir what is the use of scope resolution
Sir please explain the return statement, return optional in void function or return required in non void function
you are just awesome bro keep it up
I found no particular reason for using the integer variable x in the static data member program.
Anyways Thank You.
Thanks a lot 💙
thankssss a ton
very informative and well explained .. Thanks Simple Snippets 👍❤
My pleasure!
Awesome!
in last example count was declared as private but it intialized from out side class it was showing error for me
you are the best....masum
Nice man
you are the best..........masum
this video clarified almost all my doubts and was really helpful. so thank you .
Most welcome kalash 😊 I'm very happy to hear this from you. I would request you to please share the videos with your friends too. ✌️ That's the biggest help & support for everyone 😁
@@SimpleSnippets i will surely do . looking forward to more videos from your channel
@@kalashjain8647 there are 400+ videos on our channel bro please check it out. You will find many helpful things 😁🤘
Thanks!!!
Most welcome buddy ✌️
why is static needed to keep a count of the objects although declaring n objects will call the default constructor n times ?
Good question. Because static variable will only be created once no matter how many times the constructor will be called. Hence static variables are class level an not object level. Thus they can be used very well to keep a track of no of objects by simply incrementing the counter variable value in the constructor. ✌️
Thank you sir
Most welcome my friend 😊
Hi can anyone explain me why the below is valid ?
Class Xyz{
static XYZ instance;
};
i couldn't find any proper explaination till now
1K th like by me...Thanks
Good explaining keep rocking
Thank you so much brother. Please share the video✌️ and keep up the support 😇
@@SimpleSnippets ok bro
Excellent bro
Thank you very much buddy, Please share this video with your friends and contacts because that will be the best help and support for our channel 😇✌
Kk bro
Thank you :)
Most welcome 😇✌️
Nice explanation
Thank you so much 😋
you are superb bro
Thank you so much 😀
What will happen if we initialize(3:24) "int myclass::count;"
Since we don't give a value, it initializes a value of 0 by default.
ayyy simple snippet bahut achha kaam karta hai re tum
Hahaha shukriya dost ❤️ this sounded like that Munna Bhai mbbs scene. Tum bohot mast kaam karta Wala 😆✌️
It's the same 😅✌️
@@akashwagh6733 hehe thought so. Also please do share the video with your friends too buddy. That'll be huge help 😁
Definitely ✌️✌️
@@akashwagh6733 thank you brother! Means a lot ❤️
awsm
Thanks bro. Please share the video with you friends 😇
Can u tell y we need "using namespace std"
Good question, here is a link to your answer - www.learncpp.com/cpp-tutorial/naming-conflicts-and-the-std-namespace/
Because you need to specify a standard io stream to start inputting and outputting
Do u do java tutorials also sir??
Yes buddy check on my channel. But it's on core Java for now
Bro.ur explaination was extraordinary. but explain some slowly bro. We can't getting u🙏🙏
Thank you so much for the compliments bro, and yes I will reduce my speed in future videos. 😇
this video really helped
super explaination!!
Well explained 👍
Thank you so much Ashutosh, really glad to hear this from you. Please do subscribe to this channel & share the content with your friends too. That will be the biggest help & support 😇
Good explanation 👏 👍
Glad it was helpful!
Plz slow your speed , else your explanation wonderful
Yes I will keep this in my mind :-)
Tanmay, bro,,,if would be more helpful if u go with some slow pace....ur clarity is also awesome....really helpful.
Love you..
Hey Dinesh, sorry for my speed bro. Sometimes I just lose track of my speed and go with the flow 😅
I will take better care of this in future for sure 😊
Why did u stop uploading man?
Hey hi, sorry for the delay buddy was busy with other work. will upload the next tutorial mostly by tomorrow or day after tomorrow. ✌
Thanka bro keep going
Thank you so much bro. Happy to hear your feedback. Do share the videos with your friends and contacts too. That'll be the best help and support 😇
Nicely explained
It would be very good if you could slow down the pace😅
I will keep that in mind in future video 😊
Main cls therila
Itta fast
can you just press the keys less forcefully. It sounds like your keys are crying man.
Lmao 😂 😂 actually the microphone is on the desk as well so that elevates the sound. But yeah in general I press them hard 😂 there's a weird satisfaction I guess by nerds! 😛
learning c++ from professors???? idhar aoo sab samjhega
Hahahah Thanks Kaushal, share this playlist with your friends too 😇
@@SimpleSnippets hiii tanmay glad you replied can you explain file handling a bit more please
Bhai Hindi 😢