Getters & Setters | C++ | Tutorial 30

  Рет қаралды 67,776

Giraffe Academy

Giraffe Academy

Күн бұрын

Пікірлер: 46
@davidjuniormz
@davidjuniormz 5 жыл бұрын
Clear and straight to the point... Thank you, that was really helpful.
@ΙσίδωροςΚαλαμάρης
@ΙσίδωροςΚαλαμάρης 2 жыл бұрын
Really helped me to clear my mind about why we need getters & setters and the differences with the constructor. Thank you!
@daboxguy3848
@daboxguy3848 3 жыл бұрын
Me :"Mom I want to watch The Avengers." Mom : "Sorry John, but it's rated dog!!!?"
@DetectiveConan990v3
@DetectiveConan990v3 3 жыл бұрын
John isn't old enough to watch dog rated movies
@AlekVS
@AlekVS 9 ай бұрын
I kept hearing about setters and getters but never really understood their utility until this very video. Thank you so much
@soloman3140
@soloman3140 10 ай бұрын
Good explanation sir
@jackdougie8
@jackdougie8 6 ай бұрын
Bro you're a lifesaver. such a good explanation. Thank you so much
@joshuavincent7884
@joshuavincent7884 4 жыл бұрын
would be cool to have a vector of strings containing all the ratings and then compare the user input to that instead of having that long if statement with a bunch of ORs
@voynich7119
@voynich7119 2 жыл бұрын
That's the one thing I did differently when I copied this for practice. It looks way cleaner. I guess it would overcomplicate the video though, since vectors are another topic that maybe not everyone knows.
@pizzaguy_
@pizzaguy_ 2 жыл бұрын
its bad for the view time, if the viewer doesnt know what a vector is they'll have to look it up
@g4zzen245
@g4zzen245 Жыл бұрын
just make a string array and for loop it checking if aRating == arr1[i] for example
@daneshsengottaiyan7221
@daneshsengottaiyan7221 3 жыл бұрын
It is good, but I can't run the full code on Getters and Setters part. It is showing me 2 errors on the if line
@manousosm.9810
@manousosm.9810 2 жыл бұрын
Really easy to understand and very helpfull indeed! Great job!
@okerelovedayrichman7743
@okerelovedayrichman7743 5 жыл бұрын
Very Very Very helpful thanks for your tutor, very straight...
@adelem8293
@adelem8293 Жыл бұрын
so helpful, thanks
@antonmakeyenko4018
@antonmakeyenko4018 4 жыл бұрын
Being a C++ developer for over 6 years, I wouldn't recommend this tutorial simply because returning std::string from a "getter" by value is a TERRIBLE idea. It's not a JS, C#, Python, etc., where objects are reference-counted, in C++ you will get a copy (copy constructor will be called and memory will be allocated) every time you call the getter. Not to mention, that getters should be const-qualified: const std::string& getValue() const { return value_; } If you try to learn C++, you MUST care about memory and general speed. If you task doesn't need this, use another language
@halumetri8957
@halumetri8957 3 жыл бұрын
thanks actually makes a lot of sense and didn’t think about it nice explanation
@musikalniyfanboichik
@musikalniyfanboichik 3 жыл бұрын
thank you for letting us noobies know
@nyxatnight45
@nyxatnight45 3 жыл бұрын
Could you please explain that passing the aRating to SetRating part 6:37 ....im a newbie so please help me out
@Ozla102
@Ozla102 4 жыл бұрын
UR SO GOOD, lovin it
@paulvaldivia8995
@paulvaldivia8995 2 жыл бұрын
If I have a private member of type bool, Do I need a getter and setter for that?
@j3froc63
@j3froc63 5 жыл бұрын
Question: Can you create a trait for the 'rating' part BUT not access/edit it because it's private?? I still don't get WHY you would set a trait of a class to Private. In your example of 'ratings', you made an 'if' statement, yet you were still able to access it within the main function. Like couldn't you have just made the 'if' statement and just ignore the fact it's private??
@nishithbaravkar7549
@nishithbaravkar7549 4 жыл бұрын
thanks a lot mike this video was good
@kino9521
@kino9521 4 жыл бұрын
Using the same "aVariable" method i get the "not declared in scope" error. Am I doing something wrong? Do I have to declare them too?
@kellenwang4606
@kellenwang4606 6 жыл бұрын
That's Nice, man
@mukongshu
@mukongshu 3 жыл бұрын
why do you see average is not in "movie “ class? there's a "MOVIE" in front of averanger in main function
@mukongshu
@mukongshu 3 жыл бұрын
another question, why do you put STRING aRating in void function? arating has already been defined as string?
@4DoGamerHDD
@4DoGamerHDD 6 жыл бұрын
Good way in explanation
@mangeshmane1749
@mangeshmane1749 6 жыл бұрын
Hey I want default and parameters constructor in cpp
@jeezx689
@jeezx689 3 жыл бұрын
So why can't my prof explain it this simply?
@shrivatsankchari1729
@shrivatsankchari1729 3 жыл бұрын
top lad mike
@Ryan-ez4op
@Ryan-ez4op 5 жыл бұрын
HELPFUL!
@kian5426
@kian5426 Жыл бұрын
The goat
@taraspokalchuk7256
@taraspokalchuk7256 5 жыл бұрын
i still don't see the point of getters and setters. you justify them by making an obstacle (division between private and public) that you can overcome, but I don't see the point of the obstacle either. you justify the need for private and public by saying that otherwise the users could input nonsensical data, but you could manage it in Movie() method.
@melvin4524
@melvin4524 Жыл бұрын
You're right, there is no need for getters and setters, You should learn from people like Casey Muratori
@os5803
@os5803 10 ай бұрын
thx ((:
@mukongshu
@mukongshu 3 жыл бұрын
if you don't put "rating" in private and only use function to make the restriction , it also works! so what's the point??? why do you put it in private? coz you don't want to get access easily, the way you use the function, function is enough to do the restriction, i don't get it why you still put it in private...worst video i have watched you have made so far...
@BriariusTitan
@BriariusTitan 3 жыл бұрын
when you let someone else use your code or if you forget that you want to use certain parameters, you use getters and setters. he actually explains this very very well and has a good and simple examples, unlike a lot of other teachers.
@RealityCheck6969
@RealityCheck6969 Жыл бұрын
This white background hurts my eyes.
@rodolfoalva422
@rodolfoalva422 5 жыл бұрын
not saying you're an awful explainer. just can see everything else!!!!
@joshuavincent7884
@joshuavincent7884 4 жыл бұрын
not saying you're an idiot, but you're trying to learn something without knowing the basics
@joshuavincent7884
@joshuavincent7884 4 жыл бұрын
@@rodolfoalva422 if you know the basics why are you complaining that you don't understand the code in this video?
@programmer4833
@programmer4833 3 жыл бұрын
Three words : you are stupid.
@rodolfoalva422
@rodolfoalva422 5 жыл бұрын
tutorial is so useless! I have to skip and go back to see other code that matters!!!
@lucasaraya1673
@lucasaraya1673 5 жыл бұрын
its part 30 of a series what do you expect
Inheritance | C++ | Tutorial 31
7:31
Giraffe Academy
Рет қаралды 15 М.
Constructor Functions | C++ | Tutorial 28
9:21
Giraffe Academy
Рет қаралды 25 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
C# getters & setters 🔒
4:06
Bro Code
Рет қаралды 168 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 100 М.
C++ GETTERS & SETTERS explained easy 🔒
6:12
Bro Code
Рет қаралды 19 М.
Classes & Objects | C++ | Tutorial 27
12:34
Giraffe Academy
Рет қаралды 29 М.
C++ Programming Tutorial 90 - Getters and Setters
8:06
Caleb Curry
Рет қаралды 32 М.
CONST in C++
12:54
The Cherno
Рет қаралды 416 М.
C++ Programming | In One Video
40:27
Giraffe Academy
Рет қаралды 194 М.
you will never ask about pointers again after watching this video
8:03
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,6 МЛН
POINTERS in C++
16:59
The Cherno
Рет қаралды 1 МЛН