Static in C++

preview_player
Показать описание


Static in a class scope ► Coming soon...

Check out my favourite gear for programming:

Рекомендации по теме
Комментарии
Автор

The best C++ series that I saw. This is not a "do this, do that" manual, You shows really knowledge about You talk. Thank You!

AluizioTomazelli
Автор

Toyota acceleration issue that caused several deaths, was found they had just been hacking together hamfisted extensions to their program for years and had something over a 1000 global variables. They ended up loosing their case not because of a proven bug but because the code was so bad it couldn't be properly sorted and debugged by a team of experts over 2 years.(NASA spent the first 9 months, then private firms picked it up for another year and a half.)

mytech
Автор

One thing should have been stated that we do not #incude the Static.cpp file in our Main.cpp BUT we are compiling the files together. Since Cherno always uses the VS IDE to show examples, the IDE always compile main.cpp and Static.cpp together this means that Linker works with main.obj and Static.obj files.

That's why using extern keyword with s_variable links the s_variable in Static.cpp file. This is what refering to s_variable means as stated in the video.

OmerFarukGonen
Автор

When people say that this or that channel is the most underrated I usually ignore them because it isn't true most of the time. After watching some of the videos I can really say that 327 thousand subscribers isn't enough for you. This channel haves covered c++ better than any other tutorial I have ever watched. You have explained and showed me stuff that I never really knew even though I call myself a programmer. I'm so glad that someone recommend your channel to me because it has changed the way I think about programming and actually executing a small or big project.

drkerberos
Автор

The way this series is presented is superb.

dildarsk
Автор

This video series is awesome. This is the level I've always wanted C++ explained at.

JamesStocks
Автор

There's actually three meanings of the static keyword in C++ (that I know of) (the third unmentioned one is discussed in cherno's video "Local Static"):
1. Local Static: static var inside of a function: value sticks around throughout program lifetime so same value sticks around if you rerun the function (only gets initialized once)
2. Static globally scoped var / func: Makes it visible only in this file, normally globals would be visible everywhere in program when linked
3. Static Class Vars or Functions: belongs to root class, not instances of it, same values shared across all instances (so cant access instance variables/'this' from static methods)

RemotHuman
Автор

I have been following him when he started this series
Still I come back and forth to clarify some doubt.
One of the best C++ series

inosuke
Автор

There is a meaning for static keyword inside functions. It will persists the value of local variable despite of calls.

venkateswarans
Автор

This is by far the best way to learn a programming language for those already familiar with how things basically work in my opinion...learn how it all functions and what everything means and then start actually putting it into practice. This gives you a broad perspective on how the system operates and allows you to make better judgement calls on when you need to do things a specific way.

unrealdevop
Автор

A static variable outside of a class but in a standard function also holds its value after the stack is cleaned up. Next call to the function the variable initially has its previous value.

stephenyork
Автор

Watching this channel is so nostalgic.... I remember binging your videos in COVID and I'm glad to see the channel has grown so much!

samarthm
Автор

So clear explanation. Thank you so much!

shahadalrawi
Автор

Dog, i dont even know how much to thank you.For whenever reasons you wording just clicks with me and i'm so thankful you for doing these videos.

ericjovenitti
Автор

Mind-blowing. Excellent concept sharing

bhogeswarasaikumar
Автор

Блин, всё настолько понятно и без непонятных слов, что я понял буквально всё, даже субтитры мог бы написать. Нереально информативное видео, спасибо Ян!

sleepyNovember_project
Автор

AWESOME Presentation!

static in a class means its public, shared, and the same (for that class) and
static outside a class means its private (for that file)
fantastic, I don't feel so dumb after realizing how dumb this is.
Thank you sir.

johncappelletti
Автор

Cherno, it would really be amazing if you would do a video about so called "free floating functions" and how/why they would be used and how they differ with regards to using a dedicated Utilities class with static methods... Thank you!

jwenaposse
Автор

Nice video! You have some of the best explanations of how everything works I have come across.

JDStone
Автор

Wow I was grasping at this concept for a while and this explained it so clearly. Thank you for these videos!

ryankimbrell