In this video we’re going to take a look at the const keyword and how it works with pointers, references, and class methods. Series Playlist …
Tag: const c++, [vid_tags]
Xem thêm: https://icongnghe.org/category/pc
Nguồn: https://icongnghe.org
Bài viết liên quan
24 Bình luận. Leave new
the constant is a promise which you cant break. I guess you dont know the difference between constant pointer and pointer to constant. SO you said wrong in your lecture here. I hope you prepare well on topics and then present. A small mistake can ruin all your good parts as well so take care in ur future videos.
This channel is awesome!!! Thank you for sharing your knowledge 🙂
Note for Google Style Guide:
For constants, we use the letter k. For example:
const int kMyLife = 0;
Alright. I understand this. No – I promise I understand this.
HELP ME PLEASE
every cherno video be like: if you have not watched my pointers video then first watch it
constant more like const-int
EDIT: This will never leave your head, I have tried.
3:55 That should,ve been an error
if you are planning to work with classes, assigning objects to one another and "return" object types then the CONST keyword is one of the few things you must know.
Some places where you NEED to use const
copy constructor,
code: {className(const className &object); }
assignment =("is equal to" symbol) overloaded operator,
code: {void operator=(const className &object); }
What would be the benefit of having both a non-const and a const method? If the method doesn't change anything why not always mark it as const?
why is it so flexible :&
Man! I never understand this const properly. I learned everything I could find in books, lectures and other c & c++ videos on YouTube. But this is the only video that solved all of my confusion on const.
Thanks a lot man.
I will name my son Const after this……….
I fucking hate C++ sometimes.
const int* const stuff() const
so gross. And const but mutating anyway. All these "It means x… But there's this exception".
How fucking wierd is c++
03:28 "Now let's start adding const everywhere" – Cherno be like – let the games begin baby😂
"const is basically sort of like a promise that you give, in which you promised that something will be constant, that is it's not going to change. However, it's just a promise and you can bypass that whole 'promise', and you can break your promise just like you can in real life."
I came here to learn more about C++ but I get legit life lesson instead…
Can you make the video on how you type this fast in VS?
Amazing content btw !
Ohhh Man !!! I don't know if it helped me or made me more confused 😛
int var = 5;
int const* a = &var;
std::cout << "First a= " << *a << std::endl; //5
int* b = new int;
*b = 8;
a = b;
std::cout << "Second a= " << *a << std::endl; //8
Why I can make it? Is const pointer can be ressigned? Probably I understood something wrong…
Thank you for all your videos! I just finished working through a C++ book, and I'm at the point where I try to make my first "thing," and I go "uh oh I still don't know anything." These videos are excellent for solidifying my understanding of things that I remember reading about, but do not yet have an instinct to know if I'm using them correctly yet in my own work.
One of the best teachers ever!!!
Can someone tell me what the meaning of const in a function like: "const int MyFunction() { return 5; }"
the amount of puns
11:06 hmm functional programming flashbacks