CLASSES in C++
Вставка
- Опубліковано 25 чер 2024
- Twitter ► / thecherno
Instagram ► / thecherno
Patreon ► / thecherno
Series Playlist ► • C++
BEST laptop for programming! ► geni.us/pakTES
My FAVOURITE keyboard for programming! ► geni.us/zNhB
FAVOURITE monitors for programming! ► geni.us/Ig6KBq
MAIN Camera ► geni.us/t6xyDRO
MAIN Lens ► geni.us/xGoDWT
Second Camera ► geni.us/CYUQ
Microphone ► geni.us/wqO6g7K
Slack ► slack.thecherno.com
Stream ► / thecherno
Website ► www.thecherno.com
Facebook ► / thecherno
I can't stop looking at the chicken.....
same
i cant unsee that now...
lol I didn't even notice it
lol
the same here
3:43 'variables that are made from class types are called objects' this line just made everything so much easy. Thank you.
Agreed with you 100%
Each of these 10 minute videos teach me more than one class
fuck yeah.
No joke, I learned more in two videos 16min total than I did in my 2hr class
glad I'm not the only one
Professor Xing ain't got nothing on Cherno, Easy A for data structs. ;)
True, you can play videos faster on UA-cam.
Never in my Uni days have I seen such a good youtube tutor. Clear, succinct and everything seems so much simpler
Coming from a C background and just learning C++, I have had so many people try to explain the concept of classes, but until watching your video I have never fully understood it. Thank you so much.
same here, what a relief
Personal notes:
-Members are private by default
-Classes allow us to group variables into a user-defined type and also add functionality to those variables
And those functions are called methods inside the classes.
I like the way you explain things: very simple, very fast and most importantly-nothing outside the topic. Thanks.
Soooooo.... Udemy ads keep playing on these videos telling me to sign up for a C++ course on there... Pfff, wrong place to advertise guys lmao.
Sure, because clearly you're going to learn a lot by using a single source, right?
Using an adblocker will stop the Cherno from earning money from these videos, regardless of how smug and annoying the Udemy guy is I still choose to watch the adverts to support the Cherno.
Timothy Jones Yup, it's the least we can do, if we can't support him on Patreon.
They are spamming me python and html, but i watch them anyway to help Cherno
@Gilpow, really dude... you take all of life so serious? @Dany na, I prefer to help him get those pennies that stack up from the ad views ;-)
Still waiting for that video on the back of a kangaroo!
I wish learning C++ was this easy. Having worked in C++ for 8 years in the past, it takes a long time to understand these concepts
I'm so glad you decided to ease up on the music, it makes it so much easier to concentrate on what you're saying.
Just came by to learn more from my University C++ class, and I got to say I love how your video is succinct and concise. No extra flowery wording, just straight to the point. But you do so in a way where we can understand, so you have that perfect sweet spot in teaching. Appreciate it, and I'm glad I came across your channel.
wrgg, no such thin gas extra or succx or concisx or point or etc, say, can say infix any nmw and any s perfect
@@zes3813 ??
Can't appreciate this series enough..excellent job...Best things is your videos aren't boring like other programming videos. Keep it up man. May god bless you.
*My takeaways:*
Class is a way to group data and functionalities together 0:55
looking for your comment and found it... I hope you have a summary of all the upcoming videos in the playlist.
Rasta Thanks, I did write summary for most videos in the playlist, but some of them are more complete than others :)
commenting for visibilty
So a class is essentially a struct that can have functions.
@Artem Katerynych And Struct is in Stack andClasses in Heap
Thank you so much! Simple and to the point, yet has great explanations for the things he's doing. Nice work!
Explained it quickly and clearly. Saved me a lot of time. Thanks!
1:42 "You can probably start to *C* that this is getting a little bit messy"
and that relates to how C doesn't have classes lmao
i like the way you are teaching people you are explaining everything in a higher speed you get the global vision of the subject instantly
It's always a relief to find somone that makes an impermiable thicket of jargon become meaningful.
This kind of format is definitely better for both teaching and learning.
Dude, your explanations are really impressive ... I like your KISS approach ...
you are so good at explaining , thank you
In 3 min you've explained classes better than anyone and with examples of references too kudos
Wow, in 8 minutes you managed to teach me better than my actual cs teacher.
I'm sure I'll recommend this course for a lot of people in the future! : D
Perfect!!!!! How could you explain so simple. I read and watched videos but this is the most understandable way of this topic. Thank you so much.
found your tutorials very useful, well done
Structs could have been mentioned as well in this video I guess, but not necessarily.
Great job, as always! now to the other columns of OO programming! :)
Very clear and understandable video with relevant examples. Thank you.
Or more simply, we can declare the move function inside the class and define it outside the class.
class Player
{
public:
int x, y;
float speed;
void Move(int xa, int ya);
};
void Player::Move(int xa, int ya)
{
x += xa * speed;
y += ya * speed;
}
int main(void)
{
Player player;
player.x = 1,
player.y = 2;
player.speed = 3.4;
player.Move(1, 2);
}
thank u so much for providing this c++ series .
These videos make these concepts so simple. I learn more from them than my professors lectures , and college c++ textook.
Wow that was super simple and well explained. i think I'm gonna watch the whole series now lol
Cherno becomes teacher.
100% boys' attendance.
*200%* girls' attendance.
*H a n d s o m e*
Michael O'Connell if you count us it would be probably 500%
@@amndrkwe agreed
More like 110% boys attendance, I know I'd be auditing this course
Shadow clone no jitsu
Gaes: ( ͡° ͜ʖ ͡°)
This is like Roblox Studio Development where everything has a classname, with its own functions! Thanks for the tutorials! I am loving it!
This is the best explanation i've seen. every video/tutorial didn't help me. i tried for a few months but this is the only one i consider good
really helpful and resourceful.
you are extremely coherent and i love it.
C++ is called C++ because in C "++" was used to increase the value of variable by 1. So if C=1. C++ = 2.
Which is to say, C++ is an incremented improved version of C.
@Artem Katerynych I forgot ++C was a thing
you have a gift of explaining things precisely and without all the bullshit
my brain is exploding with understanding and I am very excited.
Thanks for this great overview!!!
A side note. If you were to print x or y in the state of the code at 8:03, you would get a completely unknown value.
This is because, as he talked about in previous videos, when the variable is created it get assigned a memory address.
We have no idea what previous data was in that memory address, it could be anything.
Thus, if you print it without initializing it, most often, it will be a seemingly random integer value left over from the last variable (even from another program) that used it.
As a result, ALWAYS initialize your variables people. ALWAYS.
This vid is sooo helpful, so clear, so efficient ❤️
Hey Cherno, trying to get back into the programming world, a few questions popped into my head : what do you think about Data Oriented Design (vs. Object Oriented) ?
How effective can one use and understand DOD vs OOP ? or should i just stick to procedural kind of programming, that is, use C++ only where needed and mostly stick to C ?
I want to be able to understand the computer and what it is doing for performance reasons. What s the speed difference in those applications between the two designs ?
there s just not many resources around to poke into.
Great lesson! Thank you!
Super helpful!!! Love your videos!!!!
such a great video. i am beginner and i still understand all of the stuffs that you teach to us! Well done! Thanks :D
Genius. Learned more in this than in one whole lecture with my awful professor
I learned so much from this video, the confusion and worry I had is gone.
I've done many hobby programming projects over the years and yet I've stuck with C and never used object oriented features. However I have seen this and other examples of how it can allow doing the same things I'm doing in a lot less code. I'm doing graphics programming and so an image class makes sense as each image will have its own pixel array and width and height.
Commenting for your exposure. The best channel on UA-cam for C++ !!!
Thank you for simplifying classes for me in c++
this video really helped me understand Classes in C++ thanks cherno♥
You just earned a sub.
you are amazing man
Bohot hi Pyara Explanation. (Really Nice Explanation of the concept). Thank You
it wasn't until I watched this video did I finally understand exactly why OOP is easier. thanks to juxtaposing the function straight to the class function.
Great explanation fam thanks a lot
Thank you so much
Great explanation m8!🔥
For a split second I thought there was a real chicken behind you just chillin there.
C also has objects these are singular, structures, and arrays. Any of them could hold a pointer to a function and when u call a function through such a pointer that's exactly when things transition into OOP.
So easily understandable.
Subbed
You sir, deserve more Subs.
youtube sucks, it didn't recommend your video, while I was actually learning c++, now it's again making things interesting!
Thank you
You kinda look like Luke Steele from Empire of the Sun, you even have the same nationality.
Keep up these golden tutorials man.
Nice example of POD (Plain Old Data) type.
awesome teaching bro....
thank you so much, every other video doesn't explain it thoroughly.
thanks so much
thank you
thanķ you sir....and godbless you...give all human education about and learn programming c++...thank you
There is one thing that classes do automatically for you that's quite hard and not fully achievable by C. And that's typesafety at compile time. You can typedef structs in C, but you can walk around the typecheck by accident or on purpose. C++ on the otherhand will always give you an compile error if you work with object's of different types, unless you provide a function or overwrite an operator that gives meaning to that combination of types.
Simply awesome!
me: oh so a class is to organize data ?
cherno: no... *sight* not data, its DADA
This was an awesome explanation! I have done a little bit with UE4 blueprints so it made some things easier to understand, so hopefully the transition to C++ won't be too brutal outside of perhaps the syntax. I have a question though, would there be any reason for someone to want to use a function outside of a class as opposed to nesting it inside a class to make it a method?
Because from how I'm seeing it, by making it a method, its much easier to use your code and it eliminates the need to have to create reference variables and pass those reference variables around.
"there is nothing you can do with classes you couldn't do without them" Yeah, C is turing complete and doesn't have classes, but so is assembly or colouring squares on a piece of paper... Just because you could technically do all the same things doesn't mean that anyone on earth is actually capable of doing so :P
C still has things like structs, function pointers, etc. that can accomplish any OOP stuff in about the same amount of code. As opposed to, e.g. templates, which have no real correspondence with any C features.
You can actually define classes in C. But why would you want to? It important to know in legacy codebases
( ͡° ͜ʖ ͡°)
Thanks
wow u actually simplified 24h of senseless lectures in 8 min.
group the variable into a type and add functionality to those variables.
THANK YOU SO MUCH :)
Thanks Your So Helpful :D
Thank you brooo 💖💖
Very didactic! Thank you!
No more confusion with classes again
Great video
I am making a game in which i am trying to keep my code tided up by using classes for every character but when it comes to two characters to interact i have problems accessing the other class
great explanation :)
C# is most certainly not just OO anymore its definitely well seated as a multi-paradigm language and has been for many years. With things like ReactiveX you have data-flow, with LINQ you have functional, both are those are heavily declarative but c# is obviously also heavily imperative, reactive is data driven but async/await sand the TPL is task driven, it has very mature reflection it can easily be written procedurally.
It is basically the programming language equivalent of what English is to spoken language.
It takes good ideas, finds really robust implementations and then improves on them.
good job!
there are actually things u cant practically do without classes that is changing variables already assinged without rewriting the whole code so its technically possible to rewrite whole code but given that u dont wanna do that so u cant do it without classes
I've been using python and golang but honestly I am going to use C++ from now on.
Literally every video you have with a "new" concept just leave me thinking "Wow that's really cool", C++ seems like the perfect language.
Depends on what you want to do with C++.
If you're learning to code any of these are fine to learn in C++/C#/Python/Java/Javascript in my opinion. I would recommend playing around with a few of them just to get a feel for what you like. I wouldn't worry so much about "learning" the language, as much as learn to code, to start off because a lot of the basics/concepts are very similar. As one progresses it really depends on what is your path / end goal (use the right tool for the job). Each language is a tool, there are pluses and minuses to each. Personally would recommend Python/C#/Javascript to beginners because I think they are the most straight forward and have many branches and uses one can do particularly if you're not sure of your path.
Amazing .
wow! classes are heaven
Very nice.. explicative, I just subscribed to your channel
Loved it
the light bulb goes off! thank you.