I wouldn't recommend Cherno to somebody that hasn't had some exposure to coding yet, but after having watched many other people talk about coding at a basic level, im now ready to hear Cherno approach lessons from a higher level concept and not just simple code instructions.
I agree! I'm a web developer and studied c++ only in school like 5 years ago and never used it until now. I kinda have basic understanding of c++. This series is perfect for me as he explains along with memory things which I definitely need to understand for a reverse engineering.
im actually good, but i think its because i come from another programming language, and i just have to get the syntax and i can easily follow along with cherno's videos
If you start by watching the first video in the series and follow the series from the start it becomes quite easy. In my opinion Cherno explains everything in way even a beginner can understand and I am sure that its not that difficult to understand C++ for beginners.
I love this series. It really is the proper way to learn. Straight to the point but not ommiting important details. I especially like how you treat viewer like a thinking person not a dummy who needs everything pronounced. Keep up the good work and pointing someone to the best C++ tutorial series will be really easy.
*My takeaways:* 1. Static variables that are inside a class are shared between class instances 0:29, like global variables for the class 2. Static methods have a similar effect 1:10 3. Why we want to use static inside a class 4:50 4. Static methods can’t access non-static variables 5:35
@@leixun Were you a beginner programmer when you started this or were you just learning more? I just started really learning programming about a week ago and this is a lot to take in.
@@kylejones1336 When I took this course, I was a beginner in C++. I have to say this course was difficult for me and still is. So I just takeaway as the best as I could. You can check out a channel call freeCodeCamp, both channels are very good and provide different perspectives. More perspectives are good fur us as a learner. Happy learning! If you use LinkedIn, you can find me there.
@@leixun Have your programming skills progressed nicely? Also I have watched FreeCodeCamp I don't really like their inconsistency of teachers, some of them just seem like they are telling me what they are doing and not why. Also not sure what LinkedIn is but I am having severe difficulties retaining a lot of this information. I have started a text based game project to help me retain the information. Best of luck mate!
For those wondering about the 3:00 mark with the initializations, you must initialize static members at global scope, not within a containing class definition, unless they are 'const'.
I'm a pretty intermediate guy in C++. I found this series are actually pretty perfect for people like me => Understand most of the parts of C++ which C++ is sharing with other computer languages (PHP, Javascript, Java...), but still wanna understand trival topics like this "static" keyword & its meaning in different context. Thanks Cherno, this series is wounderful.
I remember how When I first found your channel I didn't like your content, it wasn't bad it was just either too much for me or too slow for me sometimes, but now when I have nearly triple the experience I only watch your videos because I suddenly understand what you mean, and you also say what to do, what not, uses of something, etc, thanks Cherno, you are awesome.
I always need to watch your videos 2-3 times to understand the topics fully, you covered in the videos. you are such a genius. You cover the topics that many C++ books have not covered.
Love the amount of depth that goes into these videos. And how he starts to go into deeper detail about things, but it goes beyond the scope of the lesson; I like it because it shows just how much there is a reason for everything in programming. Its not magic, and TheCherno debunks that.
Man, either your explanations are really good, or C++ is just refreshingly "simple". I feel like in other programming languages, when you truly want to understand something, you reach a point where you just kind of have to accept that "that's just how x works". Not here, everything is so simple and easily constructed, that it just makes sense. What triggered me to say this is your explanation of static methods not being able to access member variables. And how you explained that a class method is essentially just a function that's been passed an "invisible" parameter holding the class instance. This, in combination with the earlier videos where it's explained how C++ code is turned into machine instructions, just makes me feel like I really understand what the computer is doing when I write the code. Amazing. Thank you so much for this series.
many people are asking the same doubt "why declare those vars outside the class".. okay, try thinking it like this way, these variables belong to a structure or class, But being static, they are not a part of the object of the class. So when an instance of a class is created, all the members of the class which are not static are declared, because static members are not a part of any instance, so to use them, we have to bring them to a scope from where they can be accessed.. so they need to be declared outside the class.. just to bring them in a scope where they can be accessed from. like a global variable.
I was confused too because I remember using static variables in C#, and not needing to define them outside the class. Can anyone explain why that was? Is C# just automatically defining those as global variables for you?
@@pascalladal8125 Because the static functions don't need memory allocation explicitly, whereas static variables require memory allocation and hence need to be defined outside the class for the runtime to allocate memory
God damn Cherno, I cannot share all my admiration to you on how you explain the behind the scenes in this c++ series. I love your work man, great job and thanks! ♥
Hi TheCherno. Fabulous series. I'm trying my hardest to follow along (despite the breakneck speed of your lessons!). I'm astounded by your depth of knowledge of coding, and it shows in your explanation of abstract concepts. I'm just about getting it, but it will take me several run throughs. Really appreciate your efforts on putting this series together.
Static member data requires an unusual format. Ordinary variables are usually declared (the compiler is told about their name and type) and defined (the compiler sets aside memory to hold the variable) in the same statement. Static member data, on the other hand, requires two separate statements. The variable’s declaration appears in the class definition, but the variable is actually defined outside the class, in much the same way as a global variable. Why is this two-part approach used? If static member data were defined inside the class (as it actually was in early versions of C++), it would violate the idea that a class definition is only a blueprint and does not set aside any memory. Putting the definition of static member data outside the class also serves to emphasize that the memory space for such data is allocated only once,before the program starts to execute, and that one static member variable is accessed by an entire class; each object does not have its own version of the variable, as it would with ordinary member data. In this way a static member variable is more like a global variable.
Think of Pacman! "Ghost" class could have a static bool "eatable". When the character consumes an "energizer" then by setting "eatable" to "true" all the ghosts would become vulnerable, and there is no need to set "eatable" to true for each of the ghosts!
Thanks, as it happens I recently run into this problem in C++ and although it wasn't a blocking problem, it's still good to know the why and how. Keep this great work, I hope you enjoy making this series
3:04 btw instead of defining them again, since C++17 you can also use the *inline* keyword to avoid doing that. so inside your struct you would just do "inline static int x, y;"
This is the first video of his I felt confused about, I'll make a mental note to learn and experiment about static from other resources, but continue on with the series
In JS, classes work in similar ways in the sense that every function has a hidden parameter to it that dictates what `this` is bound to. But never realise that it is the same case for C++. Great information!
I did take a course on c++ in college a year ago upon that time I did really understand things very good, but I've never take my c++ to next level because I didn't build anything with it, and now I'm using the Chrono series to review concepts so I can now advance and participate in open source projects
The quality of these tutorials are amazing! You are redefining the way programming tutorials should be made. Love and Respect for you Bro from PAKISTAN :)
After using Unreal Engine for a long time, i now know more about C++. few years ago i watched this video but can't understand a bit :p, thank you Cherno!
It uses the implicit constructor that just 'fills in' the variables of the class with the values that you wrote between { }, in the order you wrote them.
You should start recommending a quick programming exercise for us every time you show us new stuff. It would be motivation for us to do something on our own after we watch your video.
I often do my own exercises after the videos. Just try doing the stuff he does, by yourself, with no aids. Helps a lot. Or grab a book with examples to code. I am not expert in this field, but i like the C++ primer plus. Just study the examples and code by yourself.
This course is definitely not for a beginner :) This course is for those who already know like 2-3 languages and have like 1-2+ year experience and need to fill those 'Why though' gaps - Exactly what i needed !!!
if it would be only defined in the class it would get defined every time this class gets created so it has to be created outside the class otherwise the compiler forbits this because it makes no sens
I think declaration of static member variables in class doesn't mean those variables are set in the memory. So, You have to declare the variables outside the class(Initialization). But, the method has already been set in the memory and you can call the method as long as you declare the static member variables before. but if you don't declare the variables, and call the method, there will be link errors. Not sure if i said right. The best way is have your hands dirty on your own :)
From readings that I have gathered, this is (partly) so that the compiler can initialise the value for the static members. So, for example, the x variable, by typing int Entity::x, we initialise x to be equal to zero. This is different for non-static variables where there is no initialisation of value.
@@timkellermann7669 This makes it seem like the static int in the struct is just somewhat of a reference. There needs to be a singular explicit definition for the variables. This makes sense, but it's another place where it would be kinda nice if the compiler just took care of it.
"This is what a non-static function looks like when it's compiled". *head explosion* Of course! Of course it does. It all makes sense now! Thanks Cherno. I hadn't made that click yet. :D
So if I understand correctly, an example of wanting a static variable in a class would be something like a modifier that you want to affect all instances of the class. Say you have a class for an enemy in a game, you could modify their health or speed, etc, values. So it would be a way of every enemy having a base health, but then you could up the difficulty with a health modifier static variable.
An interview question: How will you throw an error if more than 5 objects of a class are created at a time Solution: use a static variable count to track the no. of objects. increment count in constructor and decrement in destructor
Thank you holy shit, all these TH-camrs using these long robust definitions for what it is like it’s some sort of derivative of quantum physics. “Using static for a variable within a class means there will only be one instance across all classes/objects” fuck was it that hard?
Personal Notes: - if you use it for variable, it is the same variable for all instances, i.e. if one instance changes that static variable then it is changed for all the other instances as well - a static method can be called without a class instance -static methods cannot access non-static variables, the reason is: static methods do not have a class instance(recall that all non-static methods of classes take that class instance as parameter)
Any plans for making a tutorial about CMake in the future which also shows the advanced stuff? I would really like to know how a proper and professional CMake setup looks like for C++ as I'm always struggling to get anything done with CMake.
Hi, I was wondering if anyone could help me out with a few questions. I would really appreciate it!! 1. Why is it that when static was used at 2:45 they are no longer class members? The reason why I'm asking this is that why does e.x and e.y work (btw is there a term for this kind of instantiation?) if they aren't class members? 2. This is probably the main question people were asking on why we needed to define the static variables outside the class? I read this comment by Ranziger saying that "if it would be only defined in the class it would get defined every time this class gets created so it has to be created outside the class otherwise the compiler forbids this because it makes no sense" My question is what's wrong with the variables being defined every time the class was instantiated, is it because it would take up more memory or be less efficient? Thanks for the help!
@Peterolen Thank you soo much, really cleared up my questions!! I'll might have some follow up questions later on, which I'll really appreciate if you could answer. Thanks again
For the most part, at least my understanding is, that if you create static variables in a class or struct it should probably declared as const. Like, the value of pi for instance that you need to access from multiple objects of the class type..Please, correct me if I am worng!?
I wouldn't recommend Cherno to somebody that hasn't had some exposure to coding yet, but after having watched many other people talk about coding at a basic level, im now ready to hear Cherno approach lessons from a higher level concept and not just simple code instructions.
I agree! I'm a web developer and studied c++ only in school like 5 years ago and never used it until now. I kinda have basic understanding of c++. This series is perfect for me as he explains along with memory things which I definitely need to understand for a reverse engineering.
@@jacoblee5648 Yeah, in fact, i had to put Cherno aside and get even more solid on the basics. Will be back. Would recommend to a friend.
im actually good, but i think its because i come from another programming language, and i just have to get the syntax and i can easily follow along with cherno's videos
@@zzedixx Honestly, I have had to go back to simpler content, LUL
If you start by watching the first video in the series and follow the series from the start it becomes quite easy. In my opinion Cherno explains everything in way even a beginner can understand and I am sure that its not that difficult to understand C++ for beginners.
I love this series. It really is the proper way to learn. Straight to the point but not ommiting important details. I especially like how you treat viewer like a thinking person not a dummy who needs everything pronounced. Keep up the good work and pointing someone to the best C++ tutorial series will be really easy.
And probably that is why you have your display image set to C++ logo?
You are right about dummy part!
I'm not sure if I ever learned a programming language this well, thanks for all the insights
*My takeaways:*
1. Static variables that are inside a class are shared between class instances 0:29, like global variables for the class
2. Static methods have a similar effect 1:10
3. Why we want to use static inside a class 4:50
4. Static methods can’t access non-static variables 5:35
I know this is a year old but I just want to say I love these takeaways in the comments. I appreciate you.
@@kylejones1336 Thanks
@@leixun Were you a beginner programmer when you started this or were you just learning more?
I just started really learning programming about a week ago and this is a lot to take in.
@@kylejones1336 When I took this course, I was a beginner in C++. I have to say this course was difficult for me and still is. So I just takeaway as the best as I could. You can check out a channel call freeCodeCamp, both channels are very good and provide different perspectives. More perspectives are good fur us as a learner.
Happy learning! If you use LinkedIn, you can find me there.
@@leixun Have your programming skills progressed nicely? Also I have watched FreeCodeCamp I don't really like their inconsistency of teachers, some of them just seem like they are telling me what they are doing and not why.
Also not sure what LinkedIn is but I am having severe difficulties retaining a lot of this information. I have started a text based game project to help me retain the information.
Best of luck mate!
For those wondering about the 3:00 mark with the initializations, you must initialize static members at global scope, not within a containing class definition, unless they are 'const'.
Thank you!👍
thanks
Thanks
I'm a pretty intermediate guy in C++. I found this series are actually pretty perfect for people like me => Understand most of the parts of C++ which C++ is sharing with other computer languages (PHP, Javascript, Java...), but still wanna understand trival topics like this "static" keyword & its meaning in different context.
Thanks Cherno, this series is wounderful.
After watching this like 10 times, the 11th time gave me a huge revelation. Thank you for this, I really appreciate your channel.
I remember how When I first found your channel I didn't like your content, it wasn't bad it was just either too much for me or too slow for me sometimes, but now when I have nearly triple the experience I only watch your videos because I suddenly understand what you mean, and you also say what to do, what not, uses of something, etc, thanks Cherno, you are awesome.
I always need to watch your videos 2-3 times to understand the topics fully, you covered in the videos. you are such a genius.
You cover the topics that many C++ books have not covered.
Love the amount of depth that goes into these videos. And how he starts to go into deeper detail about things, but it goes beyond the scope of the lesson; I like it because it shows just how much there is a reason for everything in programming. Its not magic, and TheCherno debunks that.
Man, either your explanations are really good, or C++ is just refreshingly "simple". I feel like in other programming languages, when you truly want to understand something, you reach a point where you just kind of have to accept that "that's just how x works". Not here, everything is so simple and easily constructed, that it just makes sense.
What triggered me to say this is your explanation of static methods not being able to access member variables. And how you explained that a class method is essentially just a function that's been passed an "invisible" parameter holding the class instance. This, in combination with the earlier videos where it's explained how C++ code is turned into machine instructions, just makes me feel like I really understand what the computer is doing when I write the code. Amazing. Thank you so much for this series.
That background is sweet, quite classy and ultraprofesional
many people are asking the same doubt "why declare those vars outside the class"..
okay, try thinking it like this way, these variables belong to a structure or class, But being static, they are not a part of the object of the class. So when an instance of a class is created, all the members of the class which are not static are declared, because static members are not a part of any instance, so to use them, we have to bring them to a scope from where they can be accessed.. so they need to be declared outside the class.. just to bring them in a scope where they can be accessed from. like a global variable.
I was confused too because I remember using static variables in C#, and not needing to define them outside the class. Can anyone explain why that was? Is C# just automatically defining those as global variables for you?
that just moves the question to "why are they in the class in the first place?"
All right, fair enough. Then why don't we have to declare static functions? They're not part of any instance as well.
@@pascalladal8125 Because the static functions don't need memory allocation explicitly, whereas static variables require memory allocation and hence need to be defined outside the class for the runtime to allocate memory
Tons of doubts were cleared!! Thank you!
God damn Cherno, I cannot share all my admiration to you on how you explain the behind the scenes in this c++ series. I love your work man, great job and thanks! ♥
Love it how he actually explains everything in the intro so you can just go back to a video to remind yourself
I have been sick and this series has been helping me get through the discomfort. tysm :D
Hi TheCherno. Fabulous series. I'm trying my hardest to follow along (despite the breakneck speed of your lessons!). I'm astounded by your depth of knowledge of coding, and it shows in your explanation of abstract concepts. I'm just about getting it, but it will take me several run throughs. Really appreciate your efforts on putting this series together.
Man this guy is a master. So thorough and clear
Static member data requires an unusual format. Ordinary variables are usually declared (the
compiler is told about their name and type) and defined (the compiler sets aside memory to
hold the variable) in the same statement. Static member data, on the other hand, requires two
separate statements. The variable’s declaration appears in the class definition, but the variable
is actually defined outside the class, in much the same way as a global variable.
Why is this two-part approach used? If static member data were defined inside the class (as it
actually was in early versions of C++), it would violate the idea that a class definition is only a
blueprint and does not set aside any memory. Putting the definition of static member data outside
the class also serves to emphasize that the memory space for such data is allocated only once,before the program starts to execute, and that one static member variable is accessed by an
entire class; each object does not have its own version of the variable, as it would with
ordinary member data. In this way a static member variable is more like a global variable.
Thank you!
Thank you! I notice form your name that you are an arab i'm too and my guess you are an egyptian right? I'm too :D
@noblenoble7943 right. Your reply after four years brought back some memories.
Think of Pacman! "Ghost" class could have a static bool "eatable". When the character consumes an "energizer" then by setting "eatable" to "true" all the ghosts would become vulnerable, and there is no need to set "eatable" to true for each of the ghosts!
Thanks, as it happens I recently run into this problem in C++ and although it wasn't a blocking problem, it's still good to know the why and how. Keep this great work, I hope you enjoy making this series
You look like levy, GothamChess
Probably the best explanation of static I've ever heard.
Bro thank you so much, this course is like reading a C++ book, youre the best.
3:04 btw instead of defining them again, since C++17 you can also use the *inline* keyword to avoid doing that. so inside your struct you would just do "inline static int x, y;"
It's incredible the way you explain this
Short and sweet. Glad I watched this, because I always thought static was a synonym for global variable.
i watched this for the 20th time and now i am begining to under stand thank you charno
hmmrgh yues
Your videos are incredibly efficient, and explained so well. You've saved me hours/days of digging through garbage.
This is the first video of his I felt confused about, I'll make a mental note to learn and experiment about static from other resources, but continue on with the series
In JS, classes work in similar ways in the sense that every function has a hidden parameter to it that dictates what `this` is bound to. But never realise that it is the same case for C++. Great information!
Cherno: I'm in some Czech hotel... just don't ask questions...
Me: OK, I like a challenge.
You asked no question
An excellent and to the point explanation. It's beyond me why there is even one thumbs down! Great job and thank you for producing these series.
I did take a course on c++ in college a year ago upon that time I did really understand things very good, but I've never take my c++ to next level because I didn't build anything with it, and now I'm using the Chrono series to review concepts so I can now advance and participate in open source projects
man, those statics are nuts
Totally an underrated channel
one of the most valuable lessons in c++
Every sentence coming out of his mouth is gold.
That's disgusting to imagine, but I agree.
Great for a refresher. Thanks!
Excellent series. Best place for a newbie to start learning.
Wow this is way too good. Why can't everyone teach like you do?
The quality of these tutorials are amazing!
You are redefining the way programming tutorials should be made.
Love and Respect for you Bro from PAKISTAN :)
These videos are fabulous! Though having proper exercises is my biggest concern! having some short videos or even simple questions would be a blast!
I don't how people find reasons to dislike this type of videos.
Why is this guy so amazing?
A tutorial about multiplatform coding with C++, would be awesome, thanks and excellent videos, subscribed already!
perfect explanation
After using Unreal Engine for a long time, i now know more about C++. few years ago i watched this video but can't understand a bit :p, thank you Cherno!
For "Entity e1 = { 5, 8 };", how did the compiler know which variables to assign to? There was no constructor defined.
It uses the implicit constructor that just 'fills in' the variables of the class with the values that you wrote between { }, in the order you wrote them.
I had the same question. He should have explained that instead of steamrolling over it at mach 2
Its an initialization list bro
This is very bad. This should not exist. For programmers coming from a different language background, it will be strange and ambiguous.
Vighnesh Raut It exists in other languages like C# too (Assuming you're talking about default constructors).
You should start recommending a quick programming exercise for us every time you show us new stuff. It would be motivation for us to do something on our own after we watch your video.
I agree cuz just watching won't make u get all the stuff mentioned
Else what u can do is tryna make quick exercises for urself
I often do my own exercises after the videos. Just try doing the stuff he does, by yourself, with no aids. Helps a lot. Or grab a book with examples to code. I am not expert in this field, but i like the C++ primer plus. Just study the examples and code by yourself.
Its kinda your job to learn, this guy cherno is just doing free teaching.
Get your exercise on your own, be thankful that he's doing this for free. son of a bitch
@@castro6612 HEY WOAH
The last minute of this video.... BOOMMM!!!!!!! mind opener
Thanks a lot mate, your videos have cleared a lot of my doubts. Love this complete series
This course is definitely not for a beginner :) This course is for those who already know like 2-3 languages and have like 1-2+ year experience and need to fill those 'Why though' gaps - Exactly what i needed !!!
To be honest, thank you so much for your valuable sharing
love the cherno
This is a wonderful explanation!
After this video! I understood more about Python and why class methods are either being passed a self or cls.
This is Eye opening
Fantastic video!! Your work is great!
I didn't understood at minute 3:20, why it needs to add the definition if it was the declaration on the class?
In C++, static members must be explicitly defined.
if it would be only defined in the class it would get defined every time this class gets created so it has to be created outside the class otherwise the compiler forbits this because it makes no sens
I think declaration of static member variables in class doesn't mean those variables are set in the memory. So, You have to declare the variables outside the class(Initialization).
But, the method has already been set in the memory and you can call the method as long as you declare the static member variables before. but if you don't declare the variables, and call the method, there will be link errors.
Not sure if i said right. The best way is have your hands dirty on your own :)
From readings that I have gathered, this is (partly) so that the compiler can initialise the value for the static members. So, for example, the x variable, by typing int Entity::x, we initialise x to be equal to zero. This is different for non-static variables where there is no initialisation of value.
@@timkellermann7669 This makes it seem like the static int in the struct is just somewhat of a reference. There needs to be a singular explicit definition for the variables.
This makes sense, but it's another place where it would be kinda nice if the compiler just took care of it.
Question!
Why do we need to declare static variables (like: int Entity::x) but not static methods (like: void Entity:print() )??
Thanks again lad, love your videos!
"This is what a non-static function looks like when it's compiled".
*head explosion* Of course! Of course it does. It all makes sense now! Thanks Cherno. I hadn't made that click yet. :D
Thank you so much for this
You are great!
Thanks ! What a Teacher !
U are one great person man
live from Versailles, it's Cherno!
Amazing Video.
the c++ god returns
Great video, makes a lot of sense. Thanks!
Life saver
meritorical video, i like it
This is good.
Awesome video as always! Could you explain the principle of a singleton in c++ next please? :)
Python really helped me understand what that hidden parameter in classes is, as in python, it's not hidden
Thanks. Interesting as always!
I just found that I can use static to create semaphore. That's amazing.
So if I understand correctly, an example of wanting a static variable in a class would be something like a modifier that you want to affect all instances of the class. Say you have a class for an enemy in a game, you could modify their health or speed, etc, values. So it would be a way of every enemy having a base health, but then you could up the difficulty with a health modifier static variable.
Thank you very much ! :)
An interview question: How will you throw an error if more than 5 objects of a class are created at a time
Solution: use a static variable count to track the no. of objects. increment count in constructor and decrement in destructor
Thanks😊
Thank you holy shit, all these TH-camrs using these long robust definitions for what it is like it’s some sort of derivative of quantum physics.
“Using static for a variable within a class means there will only be one instance across all classes/objects” fuck was it that hard?
Which city are you visiting? I am from the Czech Republic as well, the hotels in our capital are very nice, although very expensive.
Thank you very much for these C++ lectures, learned so much about the language, really appreciated, I hope you keep making these videos.
Personal Notes:
- if you use it for variable, it is the same variable for all instances, i.e. if one instance changes that static variable then it is changed for all the other instances as well
- a static method can be called without a class instance
-static methods cannot access non-static variables, the reason is: static methods do not have a class instance(recall that all non-static methods of classes take that class instance as parameter)
I'm wondering though why we wouldn't declare static functions as we declared static variables.
What is difference between Static Class Methods and regular functions?
Why does the initializer fail at 2:40 and not the three lines above?
Thank you!
can you please explain what is the need of 3:11? That part was confusing.
what is this magic :o! another video!
Any plans for making a tutorial about CMake in the future which also shows the advanced stuff? I would really like to know how a proper and professional CMake setup looks like for C++ as I'm always struggling to get anything done with CMake.
Hi, I was wondering if anyone could help me out with a few questions. I would really appreciate it!!
1. Why is it that when static was used at 2:45 they are no longer class members? The reason why I'm asking this is that why does e.x and e.y work (btw is there a term for this kind of instantiation?) if they aren't class members?
2. This is probably the main question people were asking on why we needed to define the static variables outside the class? I read this comment by Ranziger saying that
"if it would be only defined in the class it would get defined every time this class gets created so it has to be created outside the class otherwise the compiler forbids this because it makes no sense"
My question is what's wrong with the variables being defined every time the class was instantiated, is it because it would take up more memory or be less efficient? Thanks for the help!
@Peterolen Thank you soo much, really cleared up my questions!! I'll might have some follow up questions later on, which I'll really appreciate if you could answer. Thanks again
Oh, so it's just like how statics work in java classes. Thx!
The whole video makes sense except for the linker error at 3:00. Why would you need to manually define those variables?
For the most part, at least my understanding is, that if you create static variables in a class or struct it should probably declared as const. Like, the value of pi for instance that you need to access from multiple objects of the class type..Please, correct me if I am worng!?
3:20 can anyone explain plz why do we need those lines 'int Entity::x;' 'int Entity::y;'
THANKS
so static in a class is like making every instance of objects from the class have the same value for that static
great video !!!