Buckys C++ Programming Tutorials - 58 - function Templates

  Рет қаралды 399,072

thenewboston

thenewboston

Күн бұрын

Пікірлер: 235
@kadenzxc
@kadenzxc 9 жыл бұрын
Made it half way through the video without realizing your keyboard was upside down. I applaud you.
@rubyPWNS1
@rubyPWNS1 8 жыл бұрын
+Kaden Burgart It can't be real, right?
@prayushkhadka6981
@prayushkhadka6981 8 жыл бұрын
how was he spacing?? makes you think
@g38ra
@g38ra 8 жыл бұрын
I think there's even someone's chuckling in the background @ 6:12 or was that the keyboard being flipped by him.
@curious_sphinx
@curious_sphinx 7 жыл бұрын
What you should be applauding is his sense of humor!
@JishKlur
@JishKlur 9 жыл бұрын
It is crazy watching this video now when i first started programming 4 years in my free time as a beginner. Now I am learning this in college and I happened to stumble upon one of buckys videos for help and it feels unreal that now I am actually doing this as a career.
@MrR3set
@MrR3set 7 жыл бұрын
Josh Klauer You just described what will be me in just 4 weeks :) I learnt all this on 2015 but i forgot couple things i wanna sharp
@johnmullin2963
@johnmullin2963 9 жыл бұрын
"Alright Bill, Let me be. I will do this."
@TheVerbalAxiom
@TheVerbalAxiom 8 жыл бұрын
"Oh it was upside down" *Facepalms* REALLY BUCKY? REALLY? Lmao
@tige630
@tige630 3 жыл бұрын
Can't beat Bucky, this is the best cpp series I have ever seen, concise and straightforward every time.
@jurakpreetsingh2155
@jurakpreetsingh2155 3 жыл бұрын
Hey ,can you code in c++?
@Seyeumi
@Seyeumi 5 жыл бұрын
oh my god the way you explained this was so perfect. This is the exact kind of approach I need when being taught coding, a more analytical approach. Thank you so much! This helped immensely 😇
@karnkraftverk
@karnkraftverk 10 жыл бұрын
Thanks man, reading my book is useless, I never learn anything, but from these videos I understand it directly!
@user-tz9kn1nu3u
@user-tz9kn1nu3u 5 жыл бұрын
What books you were reading if I may know?
@rarity7797
@rarity7797 3 жыл бұрын
Were you reading your book upside down like how Bucky was using his keyboard upside down?😂
@tiygar8548
@tiygar8548 3 жыл бұрын
@@rarity7797 xD
@ikllnp
@ikllnp 13 жыл бұрын
You are the best C++ programming instructor ever. I wish you taught me back in school
@jasontiller
@jasontiller 8 жыл бұрын
Thanks Bucky! I know this stuff takes time, so it's cool that you're doing this. Just a few things: 1. Bill Gates doesn't run Microsoft any more. 2. The compiler instantiates a new copy of addCrap for each time it's called with a different argument type. There is no polymorphism going on - templates are purely a compile-time facility.3. You can indeed add chars and strings together - anything that supplies an operator+ and a copy constructor will as addCrap arguments or any built-in type that supports addition will work.
@ignitiondj4025
@ignitiondj4025 7 жыл бұрын
WHAT HOW DID YOU WRITE EVERYTHING WITH YOUR KEYBOARD UPSIDE DOWN
@raurus8202
@raurus8202 6 жыл бұрын
don't question bucky, underling
@Sokar599
@Sokar599 11 жыл бұрын
Oh it was up side down :P lol
@JackKirbyFan
@JackKirbyFan 7 жыл бұрын
I SWEATED learning Templates because it was coated with layers of complexity. You broke it down to - oh -- that's it!!!! Wow! Best teacher OUT THERE!!!! WELL DONE!
@sankhanilnayek9345
@sankhanilnayek9345 5 жыл бұрын
Love that southern drawl man. Guns, barbecues and C++. Sounds like a blast.
@maxfried5328
@maxfried5328 2 жыл бұрын
Bucky is still saving college kids in 2022
@khanhchanto3128
@khanhchanto3128 8 жыл бұрын
Thank you Bucky, this is so useful. I was frustrating about this topic and when I google it, i just couldnt find a source that explains well. I own you one.
@MrJapug
@MrJapug 6 жыл бұрын
Bucky after many months of struggling to understand templates, it finally made sense watching this video!!!! I have a cognitive disorder and this has been my biggest challenge when it comes to programming since I started studying this stuff! Thank you 🙏 so much! I love your tutorials btw!
@bpmoran89
@bpmoran89 9 жыл бұрын
Been watching you since my intro class. you rock!
@raftingdon2
@raftingdon2 9 жыл бұрын
damn, I wish I would have found you 3 months ago. I was attempting to write a template function and having issues and I found this. I really enjoy the way you describe the reasons for doing some of this stuff. It actually helps understand the concept. The book I have just describes what it is, and I leave myself wondering "Why in the world would you ever do that".
@JoseGonzalez-rt5fk
@JoseGonzalez-rt5fk 7 жыл бұрын
6:05 The moment when you are teaching someone a lesson, but you realized the lesson you're trying to tell is actually upside down.
@gabrissk02
@gabrissk02 9 жыл бұрын
Bucky, you probably have already figured out what you hit at 5:39, but anyways, for anyone who doesn't know... It's the debugger (hit the f8). While debugging, you can't close the terminal window
@anteconfig5391
@anteconfig5391 7 жыл бұрын
"See that's what you guys get when you buy a new keyboard and all the keys are all over the place, I'm sorry this is like a keyboard... oh wait a minute! Oh it was upside down. ok it's fine now"
@abhijeetckar
@abhijeetckar 7 жыл бұрын
i love the way bucky brings his compiler down from the corner to show us output.. like!! Surprise!!!
@4Y0P
@4Y0P 9 жыл бұрын
Who's Jenna? :D
@g38ra
@g38ra 8 жыл бұрын
Yep, never heard of that as a variable before, she must be too special ;)
@4Y0P
@4Y0P 8 жыл бұрын
W ALT Haha yeah, such a pretty name too
@black_squall
@black_squall 8 жыл бұрын
Slooty name
@agnesakne4409
@agnesakne4409 7 жыл бұрын
some pretty girl he fucked
@TheMusterionOfRock
@TheMusterionOfRock 3 жыл бұрын
This standup show has a really good programming tutorial also
@humzauddin6692
@humzauddin6692 4 жыл бұрын
"Oh it was upside down" Bucky I love you hahaha
@jamshaidmushtaq1811
@jamshaidmushtaq1811 5 жыл бұрын
One of the major parts of this video was Bucky's battle with his keyboard. XD
@JokerzWyld
@JokerzWyld 9 жыл бұрын
This is life saving
@alina_dial
@alina_dial 8 жыл бұрын
bucky is the coolest teacher ever
@JigsaTopman
@JigsaTopman 9 жыл бұрын
God bless you Bucky!!!
@ThunderLightStrikes
@ThunderLightStrikes 6 жыл бұрын
This guy can be a great stand up comedian.
@abdannour26
@abdannour26 6 жыл бұрын
Awesome :), you make it easy in the eye, keep up man. :)
@andeluuledna
@andeluuledna 8 жыл бұрын
Bucky is basically my savior
@jordmax12
@jordmax12 10 жыл бұрын
lol nice tutorial but see you got a thing there for "jenna"? ;)
@feilauren4166
@feilauren4166 9 жыл бұрын
Jordan Max Bucky has too much personality to have to program a girlfriend.
@jim0_o
@jim0_o 11 жыл бұрын
You should make a thumbs up script tutorial, I keep forgetting to thumb your videos up because my brain is full.
@charlesajones77
@charlesajones77 3 жыл бұрын
I have a degree in computer science (from 20 years ago) and I had no idea you could do this.
@ulianazlotnik3093
@ulianazlotnik3093 7 жыл бұрын
thank you!! love your simple explanations!
@KW-dg6fs
@KW-dg6fs 7 жыл бұрын
Imagine how much time would be saved if most professors/TAs are anywhere close to giving this good of an intro, then most of our time would be spend playing around with the codes, instead of beating ourselves up trying to understand what the fuck is the purpose of a template.
@mohamedkhalilzouitni3803
@mohamedkhalilzouitni3803 7 жыл бұрын
I salute you, bucky ! you're the man.
@yoismak
@yoismak 6 жыл бұрын
Bucky: Oh! the keyboard was upside down. me: *turns keyboard upside down*
@nizamnovruzov5648
@nizamnovruzov5648 6 жыл бұрын
I failed on my Programming exam but ,anyway thanks Bucky. Your videos helped me a lot.
@xkilla911
@xkilla911 6 жыл бұрын
F
@DeuceisLegit
@DeuceisLegit 13 жыл бұрын
Dude, I wish I could subscribe to you 100 times.
@crait
@crait 6 жыл бұрын
Bucky is the Dunkey of programming.
@dbthem
@dbthem 7 ай бұрын
5:42 this is why I use Mac 😄 Btw, great series, thank you!
@ThatDamnYouth
@ThatDamnYouth 11 жыл бұрын
What program were you using/compiling in? Awesome vid
@Trazor
@Trazor 13 жыл бұрын
awsome tutorial... meanwhile, how to make the template functions expect (take in) different type of data?? what is that way?? is there any tutorial where you have described that method ( way ) ??
@ditz3nfitness
@ditz3nfitness Жыл бұрын
We’re right about using “typename” instead of “class” in the gives the same result, right? VS ?
@avarussurava9488
@avarussurava9488 8 жыл бұрын
Thanks for the tuto but I got a question for anyone reading this, if the template function gives us such an advantage of not having to define a function type, why are functions still relevant then ?
@xxgamerwormxx2809
@xxgamerwormxx2809 8 жыл бұрын
You could even use the add() function and pass in objects that use operator overloading.
@xkilla911
@xkilla911 6 жыл бұрын
funny how you realized your keyboard was upside-down half-way but how were you typing with an upside-down keyboard for the first half of the video? did you learn how to type upside-down in your keyboarding class?
@satheeshbrcm
@satheeshbrcm 4 жыл бұрын
thanks for the tutorial.. Nicely explained !
@folksgames7047
@folksgames7047 7 жыл бұрын
Exactly what I needed thanks!
@FaizanZahidNustian
@FaizanZahidNustian 12 жыл бұрын
U give superb examples !
@TEKFROLOGIC
@TEKFROLOGIC 9 жыл бұрын
Question. So even with the template, wouldn't you still have to copy/paste it to make different functions and change to signs (ex. change the + to -)?
@EmanBook
@EmanBook 11 жыл бұрын
Hi Bucky , Could you please tell me which program you're using to record your videos ?? BTW , You really helped me with your videos ...YOU'RE A W E S O M E
@Impulse_Photography
@Impulse_Photography 5 жыл бұрын
He is using CODE BLOCKS ...
@ditz3nfitness
@ditz3nfitness Жыл бұрын
What would happen if you decided using characters instead of numbers? Would it return the character added together into a word, or what would happen?
@trannelish9
@trannelish9 4 жыл бұрын
i love it.. clear and quick
@adnanmunawar7972
@adnanmunawar7972 12 жыл бұрын
Bucky you are awesome! You rock!
@MarcosFerreira-rc1me
@MarcosFerreira-rc1me 10 жыл бұрын
I keep on having this problem whenever i add two numbers together, it gives me "4293399" :?
@SealOSRS
@SealOSRS 10 жыл бұрын
What's your code?
@asfadasfa1234
@asfadasfa1234 13 жыл бұрын
ive been wondering how to do this for about 8 months.. thanks man.
@joaopinto4422
@joaopinto4422 11 жыл бұрын
taipadada taipadada taipadada taipadada taipadada taipadada taipadada taipadada
@bovery23
@bovery23 10 жыл бұрын
I've never heard the word DA-------TA so many times!!!!
@TheFlyguy31
@TheFlyguy31 8 жыл бұрын
Excellent as always..
@Jack-4242
@Jack-4242 13 жыл бұрын
@joaoris yes he did watch tutorial 5: How to build a basic calculator there he uses "cin"
@TheKiloOhm
@TheKiloOhm 9 жыл бұрын
I understand what the template function does but if it's so great why people even bother using all the different types of data? Does this take up more memory?
@browncoffee12
@browncoffee12 12 жыл бұрын
Now a have a perfect calculator, without overloading lot's functions just like bucky mentioned haha
@avengerbolt4908
@avengerbolt4908 6 жыл бұрын
Hi your tutorials are very good. I need to print system id(mac address) for this which module I need to use ? Or can you make a tutorial on that?
@alphaahtube
@alphaahtube 12 жыл бұрын
That's why they made the reply feature, so we don't have to look for @lilsabaa reply.
@gabrielreinfalke2277
@gabrielreinfalke2277 9 жыл бұрын
nice video, bucky!
@VersusDec
@VersusDec 8 жыл бұрын
Liked on 43 second for addCrap :DDD
@Matthmatt1213
@Matthmatt1213 11 жыл бұрын
Bucky: So awesome he codes upside-down.
@addobandre99
@addobandre99 12 жыл бұрын
What if I want to restrict the types of data that are being used (for example: Inputing strings will mess up everything)?
@mirsahib596
@mirsahib596 7 жыл бұрын
i just fell from my chair when he say 'oh wait the keyboard is upside down'
@ujjvalpatel5353
@ujjvalpatel5353 7 жыл бұрын
I have one doubt, what if I assign Bucky as int ,just as you did;and then I call another function "multiplycrap" working with double. I am unable to do so, compiler argues bucky was not declared in this scope for second call ?? plz anyone reply..
@YTHandle660
@YTHandle660 7 жыл бұрын
Maybe its the coding order
@splinter1817
@splinter1817 6 жыл бұрын
i did kind of same thing , Actually bucky can be replaced with only one data type at a time . So Bucky cannot play a role of both double and int at the same time.
@OskarNendes
@OskarNendes 6 жыл бұрын
But everyone forgets that cout knows how to handle generic types of data. How should I do if I want to create the new c-out?
@NeostormXLMAX
@NeostormXLMAX 5 жыл бұрын
7:25 wow its like you read my mind i was just about to ask that lol
@rodney8018
@rodney8018 5 жыл бұрын
lmfao same, i was about to open code blocks till he said that.
@gatraw
@gatraw 13 жыл бұрын
well wait, what if I have both int and doubles and I want it to switch between the two based on user input?
@edgardrodriguezruiz
@edgardrodriguezruiz 13 жыл бұрын
Great stuff keep the good job
@reemaljaber
@reemaljaber 9 жыл бұрын
alright guys welcome back to your fjdfgjghfj c++ tutorial " stuck in my head XDDD
@mohamedtark7014
@mohamedtark7014 9 жыл бұрын
ريم الجابر are u a software engineer?
@reemaljaber
@reemaljaber 9 жыл бұрын
لا :/
@mohamedtark7014
@mohamedtark7014 9 жыл бұрын
يعنى انت شاطرة فى السى بلس بلس ولا لسه بتتعلمى زى حلاتى كده؟
@reemaljaber
@reemaljaber 9 жыл бұрын
لسه اتعلم 😹:)
@mohamedtark7014
@mohamedtark7014 9 жыл бұрын
ربنا يوفقك
@atata0215
@atata0215 5 жыл бұрын
what about define the template funktion like that : template const int& max(const int&,const int&); can you explain ?
@zerozano
@zerozano 9 жыл бұрын
What constitutes as a "general" data type. I'm trying to use the template for string and user defined class data types but I can't, for whatever reason. I have used both class and typename for the template but none of those work. I'm not even sure what the differences are honestly.
@WhatsACreel
@WhatsACreel 9 жыл бұрын
+zerozano There's no difference between “typename” and “class”. You can use classes and strings, but only if they specify the operators that you use in the template. For instance, the string class specifies the “
@JoseGonzalez-rt5fk
@JoseGonzalez-rt5fk 8 жыл бұрын
3:12 Yeah, and that way is by using the type, "auto".
@JoseGonzalez-rt5fk
@JoseGonzalez-rt5fk 8 жыл бұрын
I don't really see the difference from using function templates and using the type, "auto".
@786suhaib786
@786suhaib786 8 жыл бұрын
auto cannot be used inside a parameter list.
@JoseGonzalez-rt5fk
@JoseGonzalez-rt5fk 8 жыл бұрын
khansuhaib Any examples?
@786suhaib786
@786suhaib786 8 жыл бұрын
I may have misunderstood you but you are proposing that instead of using templates we can do something like auto add(auto a, auto b) { return a + b; } This will give a compiler error because while defining the parameters, in this case a & b we cannot use the keyword auto. If you want why is this so, it is because when we define something as auto it has to have a resolution at compile time, but since functions are dispatched at run time auto doesn't get resolved at compile time thus giving an error.
@JoseGonzalez-rt5fk
@JoseGonzalez-rt5fk 8 жыл бұрын
khansuhaib This actually works completley fine. Using auto is just like declaring a int or something. Although it would throw an error if you put a int value and a double which the error would be that you cannot add a int and a double. I would obviously only use auto if I did not know what it would give out just to make my job easier. I heard that one of the uses for templates was to find what a pointer's address was addressing to (as in finding the address of what the pointer pointed at kind of like finding the address of x even when you are using the y's pointer to x). I probably won't need this until probably I would (which would not probably be anytime soon). I would learn this when I need to is what I'm saying. I don't find much of a use for it as of now.
@marcinszymanek3894
@marcinszymanek3894 3 жыл бұрын
I will definitely remember that when my boss, Bill Gates, asks me to write a function that adds crap.
@MaxGuides
@MaxGuides 4 жыл бұрын
Great, *but* how do I pass another function through my template?
@Impulse_Photography
@Impulse_Photography 7 ай бұрын
Do using Function Templates eliminate Function Overloading ?
@MegasXLR
@MegasXLR 7 жыл бұрын
I prefer to type it as "template " as I may get confused if I type 'class' :)
@javiermarin4298
@javiermarin4298 7 жыл бұрын
gtakros it's for the sake of simplicity of the video.
@WilliamGLewis-yt9fw
@WilliamGLewis-yt9fw 8 жыл бұрын
what compiler is being used? I'm new to C++ and don't know what compilers are most accessible to new coders
@steam_vortex2608
@steam_vortex2608 8 жыл бұрын
You should try Visual Studio Community version; it's free and it's an awesome IDE with built in compiler; it also is diverse in that it can code in numerous languages depending on what types of programs you are typing to make (it can use C#, C, C++, Python, Javascript and several other languages as a default which you can choose from when initializing a file type). Just remember that when you are making additional files that communicate with one another they have to be saved in the same folder; I'm also somewhat new to coding by the way. I've been practicing for about 3-4 months and it's finally starting to make sense; in any case, good luck with your learning. Cheers!
@YouKnowMeDuh
@YouKnowMeDuh 6 жыл бұрын
For future reference, I know of the Cygwin g++ and MinGW g++ compilers, which can be used with Netbeans if you wish.
@blazingkin
@blazingkin 13 жыл бұрын
Good job mr upside-down keyboard man
@alexisperez4581
@alexisperez4581 10 жыл бұрын
Does anyone know what program he's using? I like the simple interface.
@TheGamesOfGaming
@TheGamesOfGaming 10 жыл бұрын
Code Blocks 99% sure :) Tutorial 1 was installing Code Blocks I use VS doe
@waisaleratulevu6315
@waisaleratulevu6315 10 жыл бұрын
Alexis Perez you should try using Netbeans. Its awesome
@feilauren4166
@feilauren4166 9 жыл бұрын
Alexis Perez Simple editors - Code Blocks, Sublime, Brackets, all good with very simple interfaces.
@BigSeeProduction
@BigSeeProduction 9 жыл бұрын
Fei Lauren Atom and CLion are great too!
@feilauren4166
@feilauren4166 9 жыл бұрын
Nice. Always checking out new things.
@dibbiepk
@dibbiepk 12 жыл бұрын
Well, it depends on the datatype, if its a string, and a int, then you would have to make it accept for that, id say re-watch his video over, and replace what he sais with what u want, like instead of 26 + 14, do somthing like a + b, if it doesnt work, its not like you lost anything, PM me, and ill try to get you more detail if you need it
@joshuapierson801
@joshuapierson801 11 жыл бұрын
In a sense he is right you can learn basic techniques but, in the long run you are either a programmer or a coder a programmer can write almost anything using a language . A coder is someone who knows a programming language but can only write things like cout and cin. Not knowing about file streams or string functions. So in a since you can be a beginner but in that you would be a coder not a programmer.
@mananbarjatya1822
@mananbarjatya1822 12 жыл бұрын
what if we want to do the same thing in "main" i mean like if we make a program where the user enters an anonymous data type..
@herp_derpingson
@herp_derpingson 12 жыл бұрын
Apparently I cant add a int to a double. Looks like C++ doesnt support Coercion. e_e
@dresnyd
@dresnyd 11 жыл бұрын
6:10 "Oo wait a minute, Ooh, it was upside down!" please tell me you were not referring to the keyboard :D
@wojtushom1741
@wojtushom1741 4 жыл бұрын
What IDE do you use?
@DuckSleazzy
@DuckSleazzy 12 жыл бұрын
have you ever tried square root of 4 and then -2 in windows calculator... and also sqrt(9) and then -3...??? :) ;)
@alexanderleeart
@alexanderleeart 6 жыл бұрын
so this is like dynamic typing in Python?
@Tulanir1
@Tulanir1 11 жыл бұрын
1:52 "And make sure we don't have any errors, and we have 50..."
@Fieldy6654
@Fieldy6654 11 жыл бұрын
awesome tut, beautifeel-
@srarun1996
@srarun1996 8 жыл бұрын
shouldn't i get 'c' as output if i pass char 'a' and 'b' as parameter? :P no seriously. why not char?
@ethendixon4612
@ethendixon4612 6 жыл бұрын
Alright, Bill . . . Let me be . . . I will do this!! 😂
@YTHandle660
@YTHandle660 7 жыл бұрын
Is this the same a void * functionName (Generic Pointer)
Class Templates | C++ Tutorial
12:48
Portfolio Courses
Рет қаралды 58 М.
Functions in C++
9:50
The Cherno
Рет қаралды 519 М.
Buckys C++ Programming Tutorials - 56 - virtual Functions
9:19
thenewboston
Рет қаралды 378 М.
Buckys C++ Programming Tutorials - 60 - class Templates
9:58
thenewboston
Рет қаралды 385 М.
C++ Tutorial 29 - Reading and Writing to Files - fstream
15:41
programminghelporg
Рет қаралды 798 М.
Function Templates | C++ Tutorial
10:54
Portfolio Courses
Рет қаралды 9 М.
C++ Programming Tutorial 14 - Creating Void Functions
7:56
Caleb Curry
Рет қаралды 83 М.
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 186 М.
Templates in C++
17:58
The Cherno
Рет қаралды 607 М.