Static Data Member And Static Member Function In C++

  Рет қаралды 51,361

CppNuts

CppNuts

6 жыл бұрын

JOIN ME
-----
KZfaq 🎬 / @cppnuts
Patreon 🚀 / cppnuts
COMPLETE PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
QUICK SHORT VIDEOS
-------------
C++ Short : • C++ Short Videos
C Short : • Shorts C Programming MCQ
In this video we will learn about "static data member and static member function" in c++ programming language.
There are few points about the same as follows:
1. We can define class members static using "static" keyword.
2. it can access only static data members. (non-static data member can be accessed but we have to pass the object inside function)
3. it can access private data of class.
#cpp #programming #tutorial #coding #cppprogramming #computerscience #softwareengineering

Пікірлер: 98
@cosminmoldovan3444
@cosminmoldovan3444 3 жыл бұрын
Your repetitive explanations are the best man ! I think that is the key for easy learning. I really understood what " static " mean now ! Thank you very much !
@CppNuts
@CppNuts 3 жыл бұрын
Thanks..
@rickyguerrero8618
@rickyguerrero8618 2 жыл бұрын
This was an amazing video, I couldn’t find a simple video explaining static functions and variables. This helped me tremendously and I hope you continue to post videos like these
@CppNuts
@CppNuts 2 жыл бұрын
Glad it helped!
@dwolrdcojp
@dwolrdcojp 2 жыл бұрын
Finally understand the static keyword. Thanks! Great example.
@CppNuts
@CppNuts 2 жыл бұрын
Thanks
@sallaklamhayyen9876
@sallaklamhayyen9876 2 жыл бұрын
best and easiest explanation about the topic on youtube you are really a real teacher thank you so much please continue because we need more
@CppNuts
@CppNuts 2 жыл бұрын
Thanks dude..
@AniketPanche.
@AniketPanche. 2 жыл бұрын
Watched so many videos for static data member but finally i found this masterpiece 😌
@CppNuts
@CppNuts 2 жыл бұрын
Thanks..
@mba2ceo
@mba2ceo 2 жыл бұрын
@@CppNuts U R azum :) Best teacher I ever had ;) Best wishes
@jananit7399
@jananit7399 4 жыл бұрын
Really good. Best example to understand the static data member
@CppNuts
@CppNuts 4 жыл бұрын
Thanks man..
@006daredevil
@006daredevil Жыл бұрын
This channel Deserves More subscribers. Awesome Explaination.
@CppNuts
@CppNuts Жыл бұрын
Thanks dude..
@rahulvaswani1686
@rahulvaswani1686 4 жыл бұрын
Really amazing sir Your all videos are best Paid courses too don't have such quality and clear explanation! Thanks 🙏🙇 a lot!
@CppNuts
@CppNuts 4 жыл бұрын
Thanks for the comment. It means a lot.
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Can u plz help me....why Thier is. Special declaration of y in needed outside the class I didn't get it Thanks
@bhadriramlella7697
@bhadriramlella7697 Жыл бұрын
This video is really helpful. Thank you very much
@JEN-ge1lu
@JEN-ge1lu 4 жыл бұрын
you are one of the best out here in youtube
@CppNuts
@CppNuts 4 жыл бұрын
Thanks for the encouragement..
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Can u plz help me....why Thier is. Special declaration of y in needed outside the class I didn't get it Thanks
@delphi8333
@delphi8333 4 жыл бұрын
I totally agree, this guy is saving my college degree Thanks Rupesh!
@ARNABPAL194
@ARNABPAL194 6 жыл бұрын
Thanks for this ...
@rogvilchis2853
@rogvilchis2853 Жыл бұрын
Awesome thank you !
@MrSrimagesh
@MrSrimagesh 3 жыл бұрын
Excellent Explanation Sir.
@pranit1243
@pranit1243 Жыл бұрын
Superb Explanation Thanks👍❤
@gumaryae
@gumaryae Жыл бұрын
You're the G.O.A.T 🔥🔥🔥🔥🔥🔥🔥
@umadhu8063
@umadhu8063 3 жыл бұрын
You are awesome, your explanation is toooooooooo good
@CppNuts
@CppNuts 2 жыл бұрын
Thank you so much 😀
@kamaldevarapalli2895
@kamaldevarapalli2895 Жыл бұрын
Excellent sir
@swanlinefrancis7401
@swanlinefrancis7401 5 жыл бұрын
Thank u ....🙏🙏 keep going....
@CppNuts
@CppNuts 5 жыл бұрын
You are welcome!!
@levth21
@levth21 3 жыл бұрын
great video, thank you!
@CppNuts
@CppNuts 3 жыл бұрын
Thanks..
@181Ravikiran
@181Ravikiran 6 жыл бұрын
Thanks bro.. as usual nice video... you are the best...
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Can u plz help me....why Thier is. Special declaration of y in needed outside the class I didn't get it Thanks
@181Ravikiran
@181Ravikiran 4 жыл бұрын
@@behindthescene4406 you mean for int Base::y; ??? or you need to do initialization for static member, in global scope, or else you will not be able to point it to same memory.
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Thanks ..got it ..
@ritesh_puri.
@ritesh_puri. 3 жыл бұрын
Great explanation sir, recently I face problem due to initializing static variable inside .h
@baskaranbaluchamy3667
@baskaranbaluchamy3667 5 жыл бұрын
Very good video. Thank you....
@CppNuts
@CppNuts 5 жыл бұрын
You are welcome, thanks for the comment!!
@regienaldcabanamontalvo509
@regienaldcabanamontalvo509 2 жыл бұрын
Thank you for chopping into smaller details especially for me that is a slow learner.
@CppNuts
@CppNuts 2 жыл бұрын
Welcome dude .
@neghatnazir1668
@neghatnazir1668 3 жыл бұрын
thankyou so much, these videos are really very helpfull :)
@CppNuts
@CppNuts 3 жыл бұрын
Glad you like them!
@neghatnazir1668
@neghatnazir1668 3 жыл бұрын
@@CppNuts keep growing :)
@mozeidan6481
@mozeidan6481 2 жыл бұрын
Great explanation
@CppNuts
@CppNuts 2 жыл бұрын
Thanks..
@Jam18123
@Jam18123 Жыл бұрын
very useful video, thank you. how do we ask specific questions? do you have any forum or blog? i came across some static function used by different cpp files using objects, so i was wondering why static function is used with objects. additionaly, evey c file is sending a different data to the function and function is declared as static inthe called c file.
@331sachinkiragi8
@331sachinkiragi8 Жыл бұрын
Int a=1; Cout
@cid007007
@cid007007 4 жыл бұрын
Thanks buddy for this tutorial.. Please explain Static class also ??
@CppNuts
@CppNuts 4 жыл бұрын
We don't have static class in cpp.
@mdirshadalam2617
@mdirshadalam2617 4 жыл бұрын
Hi CppNuts How can we calculate number of classes in a hierarchy? I have access only my class in the hierarchy. Thanks Irshad
@faranahmadk7401
@faranahmadk7401 3 жыл бұрын
which compiler you are using? btw great video.
@CppNuts
@CppNuts 3 жыл бұрын
This is g++ and editor is sublime text 3
@asifmahmood9358
@asifmahmood9358 4 жыл бұрын
well done
@CppNuts
@CppNuts 4 жыл бұрын
Thanks..
@nitishbidwe1108
@nitishbidwe1108 2 жыл бұрын
can we declare & initialize static variable in one place inside cpp class?
@Shiwani1991
@Shiwani1991 6 жыл бұрын
Nice Video.. can you explain about internal linkage of static member function. I have some confusion. And do static data member also have internal linkage??
@CppNuts
@CppNuts 6 жыл бұрын
Yes it is internal linkage.
@Shiwani1991
@Shiwani1991 6 жыл бұрын
internal linkage means other .cpp file will not access it even if file is included.
@CppNuts
@CppNuts 6 жыл бұрын
No if you have included the file then there is no question about becoz every thing will be copied there. And it will work like single cpp file.
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Can u plz help me....why Thier is. Special declaration of y in needed outside the class I didn't get it Thanks
@kipa_chu
@kipa_chu 2 жыл бұрын
what if we have pragma once in header file. In that case we can define static in header file ?
@pragyashrivastava4382
@pragyashrivastava4382 2 жыл бұрын
v nice
@CppNuts
@CppNuts 2 жыл бұрын
Thanks..
@yc2158
@yc2158 6 жыл бұрын
Are we using Scope resolution for only defining static data members alone? Any other use is there?
@CppNuts
@CppNuts 6 жыл бұрын
scope resolution operator can be used for namespace, member function, to access global variables... etc so as you can see here its job is to resolve the scope that's why it is called scope resolution operator.
@yc2158
@yc2158 6 жыл бұрын
CppNuts thank you so much 👍😍
@atharvadharmadhikari3612
@atharvadharmadhikari3612 4 жыл бұрын
Hey sir may I know what is meant by b1. X please
@cid007007
@cid007007 4 жыл бұрын
#include using namespace std; class Base { public: int x; static int y; static void showY(){ cout
@CppNuts
@CppNuts 4 жыл бұрын
You forgot to give memory to y. Just put static int Base::y; In global scope.
@cid007007
@cid007007 4 жыл бұрын
@@CppNuts Thanks alot
@vasulaxmana6672
@vasulaxmana6672 3 жыл бұрын
In which memory static variable is stored?
@surajsinghsolanki5059
@surajsinghsolanki5059 4 ай бұрын
One question: If we can access static data member through non static method of class, then why there is need of static method in the class?
@CppNuts
@CppNuts 4 ай бұрын
To do a common job for which no object is required.
@eduarded3943
@eduarded3943 6 жыл бұрын
All fine but one thing you forgot mention, in which memory creating static variables
@CppNuts
@CppNuts 6 жыл бұрын
thanks man I will create separate video for that.
@twotwo6616
@twotwo6616 2 жыл бұрын
@@CppNuts where would it be ?
@grayson3881
@grayson3881 2 жыл бұрын
What about static variables in functions? Do they act the same as class members.
@Jk_Vadaviya
@Jk_Vadaviya 5 жыл бұрын
Hello Which IDE is are using??
@CppNuts
@CppNuts 5 жыл бұрын
Sublime text editor 3
@mehularora3234
@mehularora3234 4 жыл бұрын
Sir , which ide u r usin ?
@CppNuts
@CppNuts 4 жыл бұрын
It is sublime text editor 3.
@moonice1194
@moonice1194 3 жыл бұрын
how can I watch the previuos video yu mentioned? please put link or give its name
@CppNuts
@CppNuts 3 жыл бұрын
What did i mentioned, it is very old video, and i don't have time to watch full video to find that line. please let me know if i mentioned something and you remember.
@SahilSingh-js9oe
@SahilSingh-js9oe 4 жыл бұрын
sir are you from india ?
@CppNuts
@CppNuts 4 жыл бұрын
Yes, i am from india, in india.
@chaitanyagujarathi4318
@chaitanyagujarathi4318 3 жыл бұрын
Sir why static member function cannot be overloaded?
@dilipshirke
@dilipshirke 4 жыл бұрын
what is use case of static member function?
@CppNuts
@CppNuts 4 жыл бұрын
Biggest use is you call them without any object of the class.
@ganesh4406
@ganesh4406 2 жыл бұрын
I can't see
@ganesh4406
@ganesh4406 2 жыл бұрын
Sir clr nhi hai aap jab dusra step sikha raha ho
@ganesh4406
@ganesh4406 2 жыл бұрын
Sir sirf aapna 10minute sikhaya voh pura clr tha baki pura blr hai
Const Data Member In C++
15:03
CppNuts
Рет қаралды 22 М.
Pure Virtual Function In C++
16:15
CppNuts
Рет қаралды 13 М.
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 31 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 66 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 36 МЛН
Static Member Functions | C++ Tutorial
8:19
Portfolio Courses
Рет қаралды 9 М.
Global Variables in C++... not as easy as it seems
18:25
The Cherno
Рет қаралды 61 М.
Friend Function | Friend Class In C++
16:26
CppNuts
Рет қаралды 26 М.
Template In C++
10:36
CppNuts
Рет қаралды 32 М.
Inline Function In C++
17:45
CppNuts
Рет қаралды 30 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
What is the Difference Between a Pointer and a Reference C++
7:58
Paul Programming
Рет қаралды 426 М.
Bit Fields In C & C++
20:36
CppNuts
Рет қаралды 21 М.
Virtual Function In C++
15:08
CppNuts
Рет қаралды 34 М.
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 31 МЛН