Buckys C++ Programming Tutorials - 13 - Using Variables in Classes

  Рет қаралды 1,119,234

thenewboston

thenewboston

Күн бұрын

Пікірлер: 1 400
@derekroot8043
@derekroot8043 10 жыл бұрын
This video goes over a programming concept called "Encapsulation". If you're still confused about this, just do a youtube search for it and you'll learn more. Also, there tends to be confusion about Functions vs Methods. One naming terminology goes like this. If a Function is nested in a Class, it's called a Method. If it's not nested in a Class, it's just called a Function. The reason for these two names is that it makes it easier to talk about functions. If someone talks about a method, you know immediately that it's attached to a class and must be assigned an object to be used. On the other hand, if they talk about a function you know that you can just call it directly. I hope this isn't too confusing. =)
@rahulkhatri1748
@rahulkhatri1748 5 жыл бұрын
it's wonderful, actually, thanks!
@alinpatricban9711
@alinpatricban9711 5 жыл бұрын
Sir, I love you.
@anthonysmith1026
@anthonysmith1026 5 жыл бұрын
very insightful thank you.
@theseangle
@theseangle 4 жыл бұрын
Thanks!)
@cyclo9
@cyclo9 4 жыл бұрын
Derek Root methods use dots ( . )
@Legendofmudkip
@Legendofmudkip 8 жыл бұрын
.....everything makes sense now. I've made a new routine to watch your videos after my classes because the way you explain things makes more sense.
@KS-2317
@KS-2317 8 жыл бұрын
+xdarkness22x you are lucky. Unfortunately i discovered this guy 6 days before my finals -_-
@Skorbeen
@Skorbeen 8 жыл бұрын
+Khatia were the 6 days enough?:p
@steve122288
@steve122288 8 жыл бұрын
+Khatia K ha try almost 12 years lol. Well i guess 5-12 if you count college. Tho most of this stuff i already knew by now but he definitely is clearing some stuff up for me; my experience having been limited and depressing.
@steve122288
@steve122288 8 жыл бұрын
actually theres alot of stuff i always wondered that he doesnt explain. Like to what depth can the program function. Like this string library is needed in this video; makes you wonder where int and double ect come from and how it knows to utilize functions and stuff. I wonder if learning C wuld help. Tho i know that understanding computers and science in general more would also help, despite that I need to progress further in my projects lol... at least im learning science on way or another tho. This is always better then nothing.
@Legendofmudkip
@Legendofmudkip 8 жыл бұрын
steve122288 There is actually a "don't know, don't care" rule-ish with programmers. My professors all follow this rule and Bucky does as well. How does the library work? Don't know, don't care. How does a program actually work? Don't know, don't care. I was taught this in my first CS class. It is a shame though because I sometimes wonder as well, how things work in C++.
@SmokeyMcHash
@SmokeyMcHash 8 жыл бұрын
I´m studying C++ from a school online and don´t get shit. After watching your tutorials however everything becomes so clear. You´r doing a better job than my own teachers in teaching me. Keep up the good work sir :)
@bluz1864
@bluz1864 5 жыл бұрын
speak the truth
@onepiecebarca
@onepiecebarca 4 жыл бұрын
welcome to the internet
@realcomments
@realcomments 3 жыл бұрын
10 years ago I learned programming from you and got a job! Now, 10 years later I am brushing up my programming skills with you again. How are you doing Bucky?
@wthrajat
@wthrajat 2 жыл бұрын
hey man. why are u brushing up your programming skills again? arent u using it in your job?
@LearnKuCode
@LearnKuCode 2 жыл бұрын
Same here, This wonderful man has given soo many of us great jobs lol
@penguin3245
@penguin3245 2 жыл бұрын
10 years is a long time , i just got in college now I'm overwhelmed by the thought that where will I be in the next ten years 🥲
@yerimdiarra7823
@yerimdiarra7823 2 жыл бұрын
Don't worry buddy, sure u will be fine Keeps your head up, and grind your way to the sun
@spicyshizz2850
@spicyshizz2850 2 жыл бұрын
WWWWW Bucky's videos helping me learn right now loll
@ChrisRenfro89
@ChrisRenfro89 9 жыл бұрын
1 week left in my C++ class. Wish I found Bucky earlier in the semester.
@KS-2317
@KS-2317 8 жыл бұрын
+Chris Renfro same here :((
@steve122288
@steve122288 8 жыл бұрын
+Chris Renfro this world is so fucked.
@ClaudiuB
@ClaudiuB 7 жыл бұрын
We all say that, especially to women: Wish I found u earlier. But don't worry mate. It's never too late for learning! xD
@shutdahellup69420
@shutdahellup69420 6 жыл бұрын
lol tomorrow is my c++ exam and im starting this right now...he saved me bro...he's my hero lol also he helped me learn c and python too :)
@mobarakjama5570
@mobarakjama5570 6 жыл бұрын
Today is my C++ final exam after roughly 2 hrs i go to my university and take the final exam so yh yeay me.
@1matzeplayer1
@1matzeplayer1 4 жыл бұрын
9 Years Later and Bucky is still the MVP of my Semester!
@briandacallos4234
@briandacallos4234 5 жыл бұрын
who's still watching our legendary bucky ? HAHAHA
@unknownguy2092
@unknownguy2092 4 жыл бұрын
came from solo learn
@Somewhat_Sassy-Commentator
@Somewhat_Sassy-Commentator 4 жыл бұрын
I’m still here. @Israt Zjhan
@andrewkevins779
@andrewkevins779 4 жыл бұрын
Here
@johnstaples5458
@johnstaples5458 4 жыл бұрын
Currently drowning in a C++ programming class and this guy is my personal flotation device.
@abdinasirahmed7150
@abdinasirahmed7150 3 жыл бұрын
imagine am starting his tutorials now hahaha
@2CloseShave
@2CloseShave 11 жыл бұрын
Everyone: "Hey now brown cow" Bucky: "hey nwornown dow"
@s33521
@s33521 4 жыл бұрын
Made me spit the water I was drinking 😂😂 after 6years 😁
@Vorazun
@Vorazun 4 жыл бұрын
1 month later
@lindahurley5711
@lindahurley5711 3 жыл бұрын
@@s33521 BBC news
@IceFried
@IceFried 10 жыл бұрын
one class to declare them all one class to find them one class to call them all and in the function define them.
@JusticeRetroHunter
@JusticeRetroHunter 10 жыл бұрын
lmfao
@slayerq3
@slayerq3 9 жыл бұрын
Hahahahaahaha xDDDD wow
@ibrahimsabe991
@ibrahimsabe991 5 жыл бұрын
you naild it :D
@nathanmulopo7490
@nathanmulopo7490 5 жыл бұрын
I don't get this help me out ppl😥
@ibrahimsabe991
@ibrahimsabe991 5 жыл бұрын
@@nathanmulopo7490 If you saw The lord of the rings movie you'd get it :D
@Mechaghostman2
@Mechaghostman2 8 жыл бұрын
This was the hardest one to follow so far. After watching it like 6 times, and pausing it so I could see the full code, and writing it 2 or 3 times, I think I got it now. I think. Would have been better if you described in detail what each line and word or whatever was doing, though. I had to run it through my head a few different times before I was able to make sense of it. I'm still a bit of a noob, but here's my understanding of it: class DrunkMan{ public: void setName(string x){ name = x; } string getName(){ return name; } private: string name; }; int main() { DrunkMan object; object.setName("Lemmy!"); cout
@Aura1002
@Aura1002 8 жыл бұрын
+Mechaghostman2 Dude we need you on every video... I understand this loads better than trying to write it down myself.
@yumi3088
@yumi3088 8 жыл бұрын
I think it would take time and experience via coding till we can actually use this technique efficient. Hopefully we all can, coz it would be a great help to shorten the code.
@AndyU96
@AndyU96 8 жыл бұрын
My initial problem was with the 'setName' and 'getName' thingies, after a while, I realized that these names could be changed.. When someone types things like 'set' and 'get', it just gives me the feeling that it's some specific code/type/something like that
@Sukidarkra1
@Sukidarkra1 7 жыл бұрын
thats not an object that is a second fuction in the buckysclass. String getName(){ is the same as the "int main ()" line of the main function all the fuction does is gives the main fuction the name so that it can be output in the last line of code.
@ClaudiuB
@ClaudiuB 7 жыл бұрын
Let me explain it to you better: He wanted to access the private variable in BuckysClass from outside the Class, and for doing this he made the variables above public(but put them in the same class aka body of the class)! The rest of the code is just the main program which simply create a string and print it out :D
@KillerPiplup
@KillerPiplup 7 жыл бұрын
I've been stuck for 2 weeks on classes! You're such a great teacher and you rarely assume we know everything about programming. Thank you so much!!! I can finally catch up and move on.
@mariomendoza7531
@mariomendoza7531 2 жыл бұрын
I've been struggling for 6 weeks in my C++ course and have just found your videos! I've never been so happy in my entire life.
@MrSimpleCF
@MrSimpleCF 3 жыл бұрын
2021 and this tutorial is just the best on youtube or any other platform, and it's FREE!!!! god bless you bucky
@georgecristianiordan3712
@georgecristianiordan3712 5 жыл бұрын
Simple simple simple, a simple example that explains all, god i finaly understood a little bit of classes, thank you sir, i owe you a lot, you made my day, i was allways looking for classes tutorials and i couldnt understand them because everyone is giving a complicated example and everyone is putting too many new informations in a code. Thank you again.
@hefhef54321
@hefhef54321 8 жыл бұрын
I had to watch this twice to get what the "string" was all about. It's basically like "int" but for text variables...
@zoo2322
@zoo2322 8 жыл бұрын
thx dude
@epicwhat001
@epicwhat001 8 жыл бұрын
not really int is a primitive data type and string is an abstract data type think of string as an array of characters wrapped up in a class.
@zoo2322
@zoo2322 8 жыл бұрын
Thx!
@cameronsluiter323
@cameronsluiter323 7 жыл бұрын
Question: Why does he use string? Couldn't char work too?
@iantupiara891
@iantupiara891 7 жыл бұрын
string is used for more than one character, while char is just for one character, so for example if you made a class of college classes, it would be correct to put string name (for instance Math), and char grade (A). I'm a student as well, not 100% sure that I explained it correctly.
@Shadowrose54321
@Shadowrose54321 7 жыл бұрын
Pointers 1)The compiler(What your putting the code in) Reads the entire Class before giving an error. So creating a set function Name first will not give you an error. 2) If you are having problems reading this code read it from bottom to top after he's done 3: String x is exactly like int x in the parameter videos. String = text. 4: Name = x is changing Private: String name; to Private: String X; 5: Return Name returns the name variable to you. So when you use getName in the main it will also allow you to display name. 6: Bo. Setname("Whatever you want here") you are now officiially using setname to change X(name) without accessing the private function 7: cout
@tinofilipino
@tinofilipino 10 жыл бұрын
Hey guys! I'm 3 years old and I understand this tutorial perfectly. I don't know how you 12 year olds struggle with this. Yes, age is indeed relevant!
@arcanerstudios
@arcanerstudios 7 жыл бұрын
Proof that you are 3 years old.
@reapercreates
@reapercreates 7 жыл бұрын
suck it
@sophiesvanidze9207
@sophiesvanidze9207 6 жыл бұрын
I didn't know that 3 year olds could type :\
@AK-fn7ro
@AK-fn7ro 6 жыл бұрын
and i'm just born 9.12 minutes before
@KovacicEhsan
@KovacicEhsan 6 жыл бұрын
you are 6 y/o now?
@n3onis
@n3onis 7 жыл бұрын
I've watched quite a few videos explaining the getter and setter functions and never seemed to understand completely. The way you explained it was crystal clear, though. I finally know what they are used for. Good job!
@elishakantor
@elishakantor 8 жыл бұрын
Just wanted to let you know you have made my life SO much easier with your tutorials!
@samflanagan77
@samflanagan77 7 жыл бұрын
Great refresher. I took "C" in the 90s. It's longevity has been truly amazing. Prior to "C", it seems like programming languages morphed every several years. I got thru vids 1-12, basically clicked thru them. This is new material but I recognize it from reviewing recreational programming material.
@MattWard89
@MattWard89 11 жыл бұрын
What other languages does he do videos on? When I take other classes I would LOVE to watch some of these videos as well!
@KobeCofini
@KobeCofini 4 жыл бұрын
I checked out his playlists and he does videos for lots of frameworks like angular and django. Seems like he mostly focuses on tools for web development.
@anastasiatsigka2352
@anastasiatsigka2352 8 жыл бұрын
I just wanted to thank you so much! You "saved" my life with these courses! Finally I can understand C++. I'm in university right now studying IT and I have a C++ course and the professor is terrible, I don't understand anything. Thanks again! Excellent work! xoxo
@Chris0nF1re
@Chris0nF1re 10 жыл бұрын
You teach much better than my tutor in college :)
@ItsRawrTopia
@ItsRawrTopia 6 жыл бұрын
He teaches better than the professors with PHDs
@Lancechingchong
@Lancechingchong 7 жыл бұрын
6 years later and this is still very helpful! Thankyou. I've been lost in my class at GaTech and this makes everything so much clearer. Great video!
@anthonyzhou4898
@anthonyzhou4898 9 жыл бұрын
Took me a while to actually understand this
@xSabretoothx15
@xSabretoothx15 11 жыл бұрын
Thank you for your excellent teaching! If someone only told me the proper way to access variables in classes, I would be totally confused. Explaining the simpler but improper way first is always a great move for a deeper understanding. I just wish you'd also included an explanation as to why class variables should be private.
@lolittashue2480
@lolittashue2480 7 жыл бұрын
Can't we set and get the variable using one function instead of two? like: public: string SetGet (string x) { name = x; return name; }
@MrHarryGaming
@MrHarryGaming 5 жыл бұрын
i was wondering the same
@crobes4155
@crobes4155 4 жыл бұрын
@@MrHarryGaming You could in this case, but if you wanted later on to get the name without knowing it, then you wouldn't be able to find out what it is without changing it.
@RepaidSpade
@RepaidSpade 9 ай бұрын
Starting my c++ journey, and it’s amazing how these videos are making stuff from even python or Java click so much better haha
@zeustheboerboel3794
@zeustheboerboel3794 8 жыл бұрын
This was quite hard! Had to watch it a couple of times before I could fully get it!
@ItsRawrTopia
@ItsRawrTopia 6 жыл бұрын
I know java already, and i watched it once I already understand.
@HenrryWith2Rs
@HenrryWith2Rs 3 жыл бұрын
what is it that makes his concepts so easily understood? you have a gift!
@nicholasgugunga2549
@nicholasgugunga2549 9 жыл бұрын
He had to go take a train and a plane and a bus just to avoid making a public variable... All just to get the program to print out a name...
@nicholasgugunga2549
@nicholasgugunga2549 9 жыл бұрын
Fair enough. Haven't made a program yet where It's needed this set up, but I'm not working on anything but basics right now. Good to know for the future at least.
@RealEyes24
@RealEyes24 9 жыл бұрын
do functions return strings ? as i remeber functions do not return strings or arrays...
@nicholasgugunga2549
@nicholasgugunga2549 9 жыл бұрын
functions return them if you program them to do so. In C++, AFAIK, they at no point do it automatically.
@lucasagua77
@lucasagua77 9 жыл бұрын
okay it was a video incredibly hard to follow. but if it says that public classes will mess up our programms i will willingly take the plane train and bus to do the private thingy. i have one doubt tho. is char and string the same thing? can someone explain to me what the heck is an array too?
@lucasagua77
@lucasagua77 9 жыл бұрын
Nicholas Vulcano what does the include does? this is the most important question haha please helppp
@jasontran81
@jasontran81 8 жыл бұрын
Your simple explanations were very helpful for a beginner to quickly learn the fundamental. Keeping it simple here was key.
@jacobcorrie
@jacobcorrie 4 жыл бұрын
just had to flex the 80+ languages haha i love it!
@sakshiiikuthari1017
@sakshiiikuthari1017 3 жыл бұрын
lmaoooo
@amandamthamalala769
@amandamthamalala769 3 жыл бұрын
Also noticed that😂😂😂
@thesickbeat
@thesickbeat 12 жыл бұрын
I'm not sure if you've already seen how property's work with events but once you got there you need to know that the big advantage you get is that you can set an event in the setter. So whenever a variable is changed the event fires. That should clear up alot.
@MattWard89
@MattWard89 11 жыл бұрын
Thanks!
@padoharaja4503
@padoharaja4503 3 жыл бұрын
OK
@fizzahbatool7562
@fizzahbatool7562 3 ай бұрын
The best C++ playlist on the KZbin for beginners❤️
@KeenanWoodall
@KeenanWoodall 10 жыл бұрын
If a computer runs through the code top to bottom, how was he able to use the variable "name" in the function getName and setName before the variable was declared. Shouldn't he get an error?
@Raidom
@Raidom 10 жыл бұрын
Maybe it reads class from private to public ?
@KeenanWoodall
@KeenanWoodall 10 жыл бұрын
Thanks
@SrJusty
@SrJusty 10 жыл бұрын
I have the same doubt and I think Otto Ling didnt answer it. What I want to know is that in class buckysclass there are two functions that use the variable name, but name is declared later, how is that he doesnt get and error? How know the functions setName and getName what the variable name is?
@luisaverhoff4884
@luisaverhoff4884 10 жыл бұрын
I know this is pretty late but in case you don't know, no it wouldn't get an error because Bucky executed each calling function in the proper order. When ever a program is executed, the main function is first called on, then it reads any variables there are initialized in the main function(very important). Next it reads each calling function( in this case setName, and then getName). In setName, he initializes the variable string x with Sir Bucky Wallace and then is stored in the string name variable and then is returned by the getName function. The name is then finally displayed on the console screen. This is order the program goes by. I hope this helps.
@KeenanWoodall
@KeenanWoodall 10 жыл бұрын
Thanks. That makes since
@limit1485
@limit1485 4 жыл бұрын
I got to say,you are an excellent teacher.I wish you were my C++ teacher instead the one I have.Very detailed and understandable explanation .Thank you.
@DariHina
@DariHina 9 жыл бұрын
lol turn on subtitle 0:02
@m.m.5049
@m.m.5049 8 жыл бұрын
+Dariush Firoozian "was going on guys is fuckin walking tours 13th C pas pas store oh and in "
@ThilebanTheEngineer
@ThilebanTheEngineer 7 жыл бұрын
it is changed now
@fckyo333ujhjjkrrrr
@fckyo333ujhjjkrrrr 6 жыл бұрын
No.
@xtinesilva
@xtinesilva 4 жыл бұрын
I’m cramming all these good stuff one week before my exam. Glad I met Bucky! Learned a lot in a short amount of time. I was about to give up, but this gave me hope. Thanks a lot sir!
@vish4544
@vish4544 7 жыл бұрын
You set name=x before declaring it (you declared string name in private which is down) why no error???
@crads3291
@crads3291 7 жыл бұрын
name = x is the same as saying x = name. He declared x in "void setName(string x)"
@mohdkumail5629
@mohdkumail5629 7 жыл бұрын
You can use variables that are private in the the same class but not in main function.
@Sakuscribe
@Sakuscribe 7 жыл бұрын
+Jav Reborn if you say "name = x" then name contain the value of x. If you say "x = name" then x contains the value of name.
@Sakuscribe
@Sakuscribe 7 жыл бұрын
+Mohd Kumail He's asking the order of operation. Since he declared the variable name after he assigned it the value of x, why does it not give an error?
@mohdkumail5629
@mohdkumail5629 7 жыл бұрын
No there is no difference the computer knows that name variable exits in the same class as the function. As long as it is in the same class as the function there will be no error.
@Mila-w6d
@Mila-w6d 12 жыл бұрын
If you look up "encapsulation," youll be able to find more information on why this is important. But basically - if your class variables are public, they can be accessed from anywhere in your program, even accidentally by another class that uses the same variable name. Keeping class variables private helps to keep things organized. When you would like to change the value of an objects variable, main, or another object, passes the variable to the object, and the object sets its variable itself.
@БатоЖигжитжапов
@БатоЖигжитжапов 8 жыл бұрын
Programming drives me crazy!!! I'm sitting at 2 am, trying to create a programm like this, searching the video like 9 times and finally, find the problem! Just spelled the object wrong once!
@samesam15
@samesam15 8 жыл бұрын
doesn't it mark where you had your error in CodeBlocks?
@romel_storm
@romel_storm 7 жыл бұрын
Yeah but sometimes the errors carry through and cause other lines that didn't have errors to have errors because the line with the original error was wrong if that makes sense. The compiler just spits out everything that it found that was wrong
@Arthurk346
@Arthurk346 5 жыл бұрын
When I was trying to figure out why my class is not working and it turned out I wrote the name of it not using CAPITAL LETTER I was like pffffffffffffffffffffffffffffffffffffffffffffffffffff
@rngnodal9316
@rngnodal9316 4 жыл бұрын
Foster Brown Almost like a car.
@cl3375
@cl3375 7 жыл бұрын
omg THANK YOU yay, I watched 55 C tutorial vids by you and I am SO glad that your C++ videos are just as helpful!
@gavin8535
@gavin8535 8 жыл бұрын
hello, what is the difference between setName and getName? i am confused about the two.
@KS-2317
@KS-2317 8 жыл бұрын
+Peterolen why can't we use return name; In setName function ?
@juanbermudez9643
@juanbermudez9643 8 жыл бұрын
+Peterolen setName and getName are both functions, and Bucky made them public in order to have access to the variable "name" which he made private, and he wont be able to use it otherwise. so in the function setName, (which has a return type of void, void means the function will not return any value) Bucky passes a parameter x which is of type string, and in the statements after the {} he defines name = to x. void setName(string x) { name = x ; } So when bucky calls this function in main bo.setName("Sir Bucky Wallace"); the function will contain the string "Sir Bucky Wallace " In string getName() Bucky returns a string, which he placed before the function. string getName() { return name; } as you can see name = " Sir Bucky Wallace" In conclusion Bucky used the functions to access a private variable. So when he couts and calls on the function cout
@SuperYtc1
@SuperYtc1 6 жыл бұрын
setName sets the name. getName gets the name.
@fatmaatta
@fatmaatta 6 жыл бұрын
Uranus loll
@fatmaatta
@fatmaatta 6 жыл бұрын
nelsitoxspace rofl
@RatIceCream
@RatIceCream 2 жыл бұрын
This stuff is literally a life changer for me in college
@Atomicgamer34
@Atomicgamer34 10 жыл бұрын
I'm 13 and this is helping me a lot!!! Thanks Bucky
@prateekgurjar1651
@prateekgurjar1651 10 жыл бұрын
I am 13 too....duh
@SeptemberLF
@SeptemberLF 10 жыл бұрын
No one cares if you're 13 or 70.
@brianvodzi2534
@brianvodzi2534 10 жыл бұрын
it doesnt matter what age you are atomic....its good yr starting young though
@MrTypingsound
@MrTypingsound 10 жыл бұрын
that's brilliant to be starting so young! I wish I had started at your age, as I'm 29 now, so by now I'd be a programming genius! :D
@AlaaElrifaie
@AlaaElrifaie 10 жыл бұрын
I was at your age when I mastered C# .. Now I'm 17, and I have a lot of applications written in ( C# .. Java .. C++ ) all over Internet! Although I study medicine :P
@MrIUniQue
@MrIUniQue 5 жыл бұрын
Just wanna say that im so greatful for your videos. Im in university studying C & C++ and your videos are so easy to understand compared to my teachers.
@sigfridsixsis3255
@sigfridsixsis3255 6 жыл бұрын
“Sir William Wallace”==“Braveheart”
@prmchuk
@prmchuk 11 жыл бұрын
Now to get around this problem, you have to create a PUBLIC function that can be access outside of your class, in main. Because the function is usable outside BuckyClass, you then code the function so that it is able to change the PRIVATE variable you created earlier. By convention, a function that does this is called a setter. Every setter, by convention, has a getter function. The getter function is also public and all it does is retrieve the info that is contained by the PRIVATE variable
@wiredelectrosphere
@wiredelectrosphere 10 жыл бұрын
What's with all that "I am 5 - 12 years old and i am fluent in Java, C, and 100 other languages, including machine code" in every single programming tutorial on youtube? And not only programming tutorials, also in math tutorials but not as often as in programming tuts. And whenever i click on that kid, all a see is Minecraft and Call Of Duty videos, not so intelligent. I think they just want to look like they are geniuses.
@TheZeldoph
@TheZeldoph 9 жыл бұрын
I can drink to that.
@numinous510
@numinous510 9 жыл бұрын
Boosting self confidence. Way too much.
@TheZeldoph
@TheZeldoph 9 жыл бұрын
If they are so good at programming why are they watching a tutorial that will teach them how to program.
@avi_mukesh
@avi_mukesh 9 жыл бұрын
Because the thing is, he DOES know other programming languages. He IS quite young (idk how old though) and he is more or less a life saviour and a God for so many people.
@azraeljallorina3295
@azraeljallorina3295 9 жыл бұрын
+Hermann Bernzweig when i was 16 i designed a shitty ass turing machine, im a genius, PRAISE ME!
@Seikuu
@Seikuu 12 жыл бұрын
Okay first the "string" part is an identifier, like int or void, but since this is just for text, it's string. Then what it does is essentially like the usual return (x or whatever you want to return) in any function. The thing is it just returns name, which it already has access to since it's in the same class. Basically the function is there so you can use name from the class with just that after it's already been set some text,instead of going through a function where you need to add the text
@Lone_Rocket
@Lone_Rocket 8 жыл бұрын
in class im learning python. But i'm here learning C++ instead. #rebel.
@Lone_Rocket
@Lone_Rocket 8 жыл бұрын
***** Wait to you get to app inventor. You will wish you had scratch.
@rngnodal9316
@rngnodal9316 4 жыл бұрын
Same
@nographite
@nographite 12 жыл бұрын
Just wanted to drop a comment on how great your tutorials are and how easy it is to understand. I never understood why I needed getter and setter methods until now. All universities should just link their programming courses to your KZbin channel
@thedillestpickle
@thedillestpickle 7 жыл бұрын
What happened? This says video 13 but I feel like he skipped a whole bunch of concepts.
@pluviophile8427
@pluviophile8427 6 жыл бұрын
same.. i understood first 12 videos perfectly, but he tried to cover whole bunch of things together in this tutorial
@bredmond812
@bredmond812 5 жыл бұрын
@thedillestpickle yeah, ive watched all his videos on C, and C++, as well as the videos of other people, including videos on VBA. (what i mean is im no programmer, but i have some experience). Anyway, my conclusion is he went from regular old programming and then suddenly jumps into object-oriented programming and then back into the regular stuff.
@daheeallgood3327
@daheeallgood3327 4 жыл бұрын
it's so crazy, how he explains it so well in such short time. But the professors make it so complicated
@karanveersingh9634
@karanveersingh9634 8 жыл бұрын
how old are u bucky ,cause u know 80 languages
@kcnameit9253
@kcnameit9253 3 жыл бұрын
You made my 2021 I learned a lot here than online school...
@jason_willis
@jason_willis 9 жыл бұрын
encapsulation
@samirgunic
@samirgunic 9 жыл бұрын
+SolomonSevens It's also a form of information hiding.
@ItsRawrTopia
@ItsRawrTopia 6 жыл бұрын
From Java
@rngnodal9316
@rngnodal9316 4 жыл бұрын
Ohhh yesss!
@seanpaul359
@seanpaul359 7 жыл бұрын
Thank you so much!! I had three 1 hour lectures last week. We started Object Oriented Programming and although my lecturer is really good, nothing seemed to make sense. It does now. Thanks again :)
@abdullahsiddiqui1065
@abdullahsiddiqui1065 10 жыл бұрын
this video was kind of hard to understand
@Quinten13
@Quinten13 7 жыл бұрын
i let my dog fart on my face
@beri4138
@beri4138 7 жыл бұрын
+Quinten Salinas WISDOM
@Siterus
@Siterus 7 жыл бұрын
compared to other people's videos not really
@abdullahsiddiqui1065
@abdullahsiddiqui1065 7 жыл бұрын
k, thanks G!
@A1babaU
@A1babaU 11 жыл бұрын
x is the string (he chosen) in which will be stored the name we want(or phrase). The way we do with strings it's the same we do with the integers (int) but strings, as bucky said, stores names and/or phrases and int stores numbers. PS: You can name a string how you want, they simply store words not number characters :) I'm sorry for my possible mistakes in english, I am not that friendly with this grammar.
@anren8162
@anren8162 7 жыл бұрын
"hey nwornown dow" cash me ousside how bow dah?
@letmecommentalready
@letmecommentalready 12 жыл бұрын
You deserve so much more credit just for the simple fact that you're 100x the teacher than most programming teachers I've had at university. You make things very clear and easy to understand! Thanks so much!
@brianvodzi2534
@brianvodzi2534 10 жыл бұрын
Hey guys im 14 and i....wait....what?.....no one cares?....really?.....ok.
@LGeefs
@LGeefs 10 жыл бұрын
Thank you
@harald921
@harald921 10 жыл бұрын
Hey guys I am 11 and I am watching a programming tutorial, please think I am cool.
@HHuynh2011
@HHuynh2011 10 жыл бұрын
Harald Kanin NO WAY!!! You are the coolest guy I know!!!! XD
@harald921
@harald921 10 жыл бұрын
HHuynh2011 Yeah like. Because this tutorial I now rule the chickz in school. Im so cool.
@CipherA
@CipherA 10 жыл бұрын
That's exactly like starting your sentence with: Well, I'm a Christian. Like we're supposed to think you're more morally upright than the rest of us.
@DavkasBr
@DavkasBr 12 жыл бұрын
Seriously? I spent a whole semester on college to understand OOP and I got it with your tuts in 15 minutes!
@gunboundph1
@gunboundph1 10 жыл бұрын
i am 1 year old i code hello world
@santosh4471
@santosh4471 9 жыл бұрын
You are really an awesome teacher. I respect you, man. Thank you so much for the tutorials. Tutorial 12 and 13 just cleared all the confusion I had about classes. Thank you again.
@user-hw1xy3sl5b
@user-hw1xy3sl5b 8 жыл бұрын
This was hard to understand.
@THEedcbb3
@THEedcbb3 3 жыл бұрын
So proud to be learning OOD from sir Bucky Wallace ask the way from Scotland, Boston....I even heard he shoots bolts of lightning from his arse
@itig12
@itig12 9 жыл бұрын
everytime you should say s you say sh and most of the time I don't care but when you say shhhhhtring its really annoying
@fl3tching101
@fl3tching101 11 жыл бұрын
A public string can be directly accessed by say typing bo.name, whereas a private string wouldn't be accessible, it's just good programming technique and saves you some trouble in the long run. Also makes it less likely to accidentally make syntax errors with the string.
@DaCurse0
@DaCurse0 8 жыл бұрын
i thought C++ is hard no. its not!
@ItsRawrTopia
@ItsRawrTopia 6 жыл бұрын
No it is hard, but it is easy when Bucky teaches
@oussamaalaoui2591
@oussamaalaoui2591 11 жыл бұрын
After watching this for 7 times, I finally understand how to use variables in classes. Thanks Bucky there goes new subscriber.
@jampk24
@jampk24 11 жыл бұрын
Wow, this video and the one before were extremely helpful. I've been trying to wrap my head around classes for a while now and I think I'm getting it now.
@ThatGuyNamedBender
@ThatGuyNamedBender 11 жыл бұрын
I actually learned how to code by following good tutorials on how to make a certain type of program as they explained how it works. But what you advised is still good because still today (been programming for 6-7 years now) I put in comments to refresh myself on how the code works. :)
@mrninjaman96
@mrninjaman96 12 жыл бұрын
because if you can brake down some process in parts (function ) do it later on it's much easer so you can set name few times without returning it and when you want to return it you call get name so you don't need to set it again it will be clear when you get to more complex problems
@bishalshrestha1422
@bishalshrestha1422 10 жыл бұрын
i had no hope in passing c++. But this tutorial made me class topper in weekly test. thanks bucky....
@ihr1414
@ihr1414 13 жыл бұрын
@BarrieIsEpic Yes. C++ is a strongly typed language, meaning you need to define what kind of value will be held in each variable. It could be a bullion, word or number, but each one requires a different variable. Many newer languages, are weakly typed, which means that any value can be entered into a variable. Although it appears more difficult to name the type of every variable, it gives the programmer more control over the program and garentees every variable will serve what it is meant to do
@dangerface3171
@dangerface3171 8 жыл бұрын
I have had 4 people explain this to me, but only you made me get it! Thank you and keep up the good work.
@DTX_
@DTX_ 11 жыл бұрын
Hey bucky thanks a lot you dont know how much you help me ... each time im stuck i come here and search for yur tutorials :) one love
@gigahertzish
@gigahertzish 11 жыл бұрын
decompilers can get it, making functions and variables private is done so that you can make two function of the same name. plus, it makes the code "feel" a bit more organized.
@registeelable
@registeelable 6 жыл бұрын
HEY NOW YOUR AN ALL STAR !!!!!, jokes aside, thanks man , you are getting me through college!! Cheers to your hard work. You can see the difference from somebody who is just making videos on the side and then people who put a huge amount of effort into their work.
@RGDCaliber
@RGDCaliber 11 жыл бұрын
When we are programming these simple programs it may seem useless to have indirect access. But when you are making larger programs, you will have many many more variables and functions. Things may get confusing and muddled up. The last thing you want is other functions accessing and changing variables. This is why it is "better practice" to use get and set methods. It is not 'wrong' just tidier and gives less room for error. :D
@-mustang-9383
@-mustang-9383 7 жыл бұрын
could you reexplain why it's become a bad Thing, when you didn't put the 'Private ' into the Code? i still didn't get that part clearly enough... would be there any examples between putting private and without private to clearly state the difference ? thank's
@NeilRoy
@NeilRoy 10 жыл бұрын
Some of the reasons to do things this way is so you can say, check to make certain the length of the name string is valid, you can do this in the class without changing any other piece of code in your program! The *setName()* function is still the same, but now it could include code to check the length, other error checks etc. It can be modified at any time on how to handle setting names without you changing any other part of your code where it sets it, only the class itself needs to be changed. On tiny projects like this it doesn't make sense, but if you're working for a living at this, or even on your own on a large project with multiple files which could have a large number of calls to the same class, you want to be able to adjust these things by only changing one piece of code in the class and not have to search down every area in your code where you used it. It's also more secure this way, you can enforce limits in your class etc... just countless reasons to do it this way, the right way as he described. Oh, one other note, in a class, everything is public: by default, there is no need to actually enter *public:* in there, just put all your public functions first, and then put in the *private:* keyword along with your private variables etc... after it.
@williamhall2386
@williamhall2386 8 жыл бұрын
I've been following along with your tutorials and changing "Bucky" to "William" so I typed out "Sir William Wallace" and got a good laugh when you said it out as I was thinking it.
@stopmotiontacos
@stopmotiontacos 11 жыл бұрын
I know it's tough, what helped me to internalize what he said was writing my own program that used the things I learned in the video, i.e. making an Object Oriented simple calculator.
@faizanbaber
@faizanbaber 7 жыл бұрын
Bucky you beauty!!! Really appreciating your all these tutorials.. you just saved my ass in tomorrow's labtask
@tienhunglam240
@tienhunglam240 3 жыл бұрын
i'm a newbie from VietNam, what u teach is easy to understand. Thanks a lot
@Dooskta123
@Dooskta123 11 жыл бұрын
x is just a random variable chose to represent a value. x in this case represents whatever string is inserted in bo.setName(); We decided that x would represent it when we said void setName(STRING X) and that is linked to the bo.setName() object.
@prmchuk
@prmchuk 11 жыл бұрын
The reason is because Bucky is showing a really simple program that uses a class. A class, really is used to do something really really really specific in your prorgam. And instead of writing the code for something that specific in your main, you create a class for it because its so specific. For example , you might have a program that compares Polygons and so you might create a Rectangle and Triangle class that sets and gets the length and width and a function to find the area and perimeter.
@fairyrarity6953
@fairyrarity6953 12 жыл бұрын
I wanted to say thanks! Your tutorials are pretty much carrying me through my C++ class.
@pinkhippie135
@pinkhippie135 11 жыл бұрын
If you use variables as public, it is very easy for some to use that same variable in another function, which would then change all the variables with the same name to the same thing. If each is set specific to their respective function, then you can reuse the variable name while it still being considered a different variable. Like declaring x as a variable in main and then in buckysClass, they are two different variables with the same name, which should hold different values
@asifkaka5052
@asifkaka5052 8 жыл бұрын
Thanks to you bucky i got 91.5 Marks in my first semister.
@Moonz97
@Moonz97 12 жыл бұрын
because sometimes you dont want to change the name and you just want it to show up like : cout
@aikolt1217
@aikolt1217 8 жыл бұрын
Thank you very much Bucky,you made my learning very easier and i always learn from your videos and seems like i have attached to your videos and you made my life brighter ,you are Genius!
@Emsee88
@Emsee88 6 жыл бұрын
Question: Why do you still need to keep the Private Class with String Name? If your cout
@aronreviour9164
@aronreviour9164 9 жыл бұрын
keep it up. i dont know what i would do without your tutorials.
@moszczynskieng
@moszczynskieng 6 жыл бұрын
Excellent video. You have made so much code I have been looking at today make real sense! Thank you sir!
Buckys C++ Programming Tutorials - 14 - Constructors
8:10
thenewboston
Рет қаралды 1,1 МЛН
Он улетел, но обещал вернуться...
00:30
ПРЕМИЯ ДАРВИНА
Рет қаралды 4,7 МЛН
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 81 МЛН
Я сделала самое маленькое в мире мороженое!
00:43
Buckys C++ Programming Tutorials - 35 - Passing Arrays to Functions
7:59
Go Has Exceptions??
16:58
ThePrimeTime
Рет қаралды 17 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,6 МЛН
Class vs Struct | C++ (What's the Difference?)
9:25
Caleb Curry
Рет қаралды 12 М.
Introduction To Classes And Objects | C++ Tutorial
11:49
Portfolio Courses
Рет қаралды 62 М.
Buckys C++ Programming Tutorials - 56 - virtual Functions
9:19
thenewboston
Рет қаралды 377 М.
Он улетел, но обещал вернуться...
00:30
ПРЕМИЯ ДАРВИНА
Рет қаралды 4,7 МЛН