Тёмный

Function Templates in C++ with Program Example | C++ Programmming 

Simple Snippets
Подписаться 247 тыс.
Просмотров 98 тыс.
50% 1

Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
--------------------------------------------------------------------------------------------- In this video tutorial we will understand template functions in C++ programming language. We will understand the concept of templates in c++ and templates for generic programming in c++
Then we will extensively cover Function Templates in C++ Programming and see a template function program example in Dev C++
Templates in C++
Template is simple and yet very powerful tool in C++
Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type.
A template is a blueprint or formula for creating a generic class or a function.
2 Types -
Function Template
Class Template
Function Templates in C++
Function templates are special functions that can operate with generic types.
This allows us to create a function template whose functionality can be adapted to more than one type or class without repeating the entire code for each type.
The simple idea is to pass data type as a parameter so that we don’t need to write same code for different data types.
We write a generic function that can be used for different data types.
Templates in C++ Theory Article - simplesnippets...
Download Dev C++ IDE : sourceforge.ne....
Download C++ Android App : play.google.co...
Simple Snippets Official Website -
simplesnippets...
Simple Snippets on Facebook-
/ simplesnippets
Simple Snippets on Instagram-
/ simplesnipp. .
Simple Snippets Google Plus Page-
plus.google.co...
Simple Snippets email ID-
simplesnippetsinfo@gmail.com
For Classroom Coaching in Mumbai for Programming & other IT/CS Subjects Checkout UpSkill Infotech - upskill.tech/
UpSkill is an Ed-Tech Company / Coaching Centre for Information Technology / Computer Science oriented courses and offer coacing for various Degree courses like BSc.IT, BSc.CS, BCA, MSc.IT, MSc.CS, MCA etc.
Contact via email /call / FB /Whatsapp for more info
email - upskillinfotech@gmail.com
We also Provide Certification courses like -
Android Development
Web Development
Java Developer Course
.NET Developer Course
Check us out on Social media platforms like Facebook, Instagram, Google etc
Facebook page - / upskillinfotech
Insta page - / upskill_infotech
Google Maps - goo.gl/maps/vj...
Intro Music by - DSTNCT MUSIC
DSTNCT MUSIC FB page - / dstnctmusic
DSTNCT MUSIC RU-vid Channel - / @dstnct5838

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 151   
@SimpleSnippets
@SimpleSnippets 5 лет назад
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌
@dinesh.p8642
@dinesh.p8642 5 лет назад
brother,,U deserve more subscribers,,and publicity,,i will do my part to achieve it,,thanks for ur free quality content and i am very much confident in c++ programming only because of ur content...once again thank you somuch brother.. P.Dinesh
@SimpleSnippets
@SimpleSnippets 5 лет назад
Hey Dinesh, thank you so much bro for such a wonderful comment & your support is the biggest help for the channel 😊 I'm glad to hear this from you ✌️ Also we just crossed 50K subs so stay tuned for the surprise 😉
@dinesh.p8642
@dinesh.p8642 5 лет назад
@@SimpleSnippets it's indeed a nice part of you in replying ur subscribers..coz it makes us feel good that we have some relationship with people like you.that makes the difference in getting knowledge brother..bye
@SimpleSnippets
@SimpleSnippets 5 лет назад
@@dinesh.p8642 yes bro, I value all my subscribers a lot & pretty much reply to all of them. Its because of all of your support that our channel has grown so much bro :-)
@krohit65
@krohit65 4 года назад
Bhai tm c++ ka playlist Kyu Nhi banate mujhe sab topic dhund ke padhna padhta hai
@ramishmasood5782
@ramishmasood5782 5 лет назад
This channel is extremely underrated. Good job (y)
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much Ramish for the compliments. And yeah I get that underrated comment quite often😥 IDK how to reach to more users. Please do share the content with your friends buddy, will be really helpful ✌️
@ramishmasood5782
@ramishmasood5782 5 лет назад
@@SimpleSnippets I am a uni student and I ask everyone who faces difficulty regarding anything, to visit your channel to see if their queries are solved. Keep up the good wor k.
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much bro 😇✌️ this means a lot to me. Keep sharing and keep up the support ✌️
@i_write7500
@i_write7500 Год назад
Exactly!
@krishnsinghrajawat6813
@krishnsinghrajawat6813 3 года назад
Every video, I watch, I will gonna say Tanmay Sakpal ki Jai 😅 I don't get tired watching your videos man what quality hats off..
@SimpleSnippets
@SimpleSnippets 3 года назад
Thank you so much 😀
@viveklamba3176
@viveklamba3176 5 лет назад
Wow ...its so catchy....the concept are on point.....he deserves more subscribers ...
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much Vivek ♥️ Hopefully with your support our channel will grow more 😊 Do share the video with your friends too ✌️
@mariusmarinescu3198
@mariusmarinescu3198 5 лет назад
Super. Very intuitive and catching. I will see all your videos
@SimpleSnippets
@SimpleSnippets 5 лет назад
That's amazing to know buddy 😊 Very happy to hear this from you. Hope you like them all and if you do please share them with your friends too 😊✌️
@prashantm2521
@prashantm2521 4 года назад
Yeah you need to be promoted sir, Hats off .
@SimpleSnippets
@SimpleSnippets 4 года назад
Thank you buddy. Glad to hear this from you. please do share this videos and our channel with your friends too bro, thats the biggest help and support 😇
@purvapawar6843
@purvapawar6843 5 лет назад
Clearly understood from your stuff.Thank you so much Tanmay .Very thanks......
@SimpleSnippets
@SimpleSnippets 5 лет назад
Most welcome Purva 🤟 glad to hear this from you. I would request you to please share the videos with your friends too 😋
@mahesh-jg3zx
@mahesh-jg3zx 5 лет назад
I'm seeing aLL the videos of c++,sir. but you are osm sir, You are giving the Best to the students
@SimpleSnippets
@SimpleSnippets 5 лет назад
Most welcome my friend ♥️
@TheBackBencher
@TheBackBencher 5 лет назад
u deserve way more views and subs..
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thanks bro 😊. The only way this can happen is if you help by sharing the videos with your friends buddy 😊✌️
@arpita0608
@arpita0608 2 года назад
I guess if you even do not specify the it will work. Just have to mention two parameters of the same datatype.
@ayoubkorichi7043
@ayoubkorichi7043 2 года назад
Thank u so much, I understood very well. You explained it in such a perfect way
@JalajBhandula
@JalajBhandula 4 года назад
Thanks for the informative videos , You are giving your best thanks for that also
@SimpleSnippets
@SimpleSnippets 4 года назад
Thank you for the positive feedback buddy. Please do share the video with your friends and contacts as well. Thats the biggest help and support you can provide to all 😇✌
@saikrishnavadali05
@saikrishnavadali05 4 года назад
First liked, then watched
@SimpleSnippets
@SimpleSnippets 4 года назад
Hahah Thank you Sai ✌
@prajaktamodhave2464
@prajaktamodhave2464 4 года назад
ur all videos are juz fab ,hope so it will help mi in pracs exam
@SimpleSnippets
@SimpleSnippets 4 года назад
That's really amazing to know Prajakta 😁 glad to hear this from you. Please do share this videos with your friends also & All the best for your exams ✌️
@yaswanthmanikanta664
@yaswanthmanikanta664 4 года назад
Great content and im wasting thousands on this courses outside...this is very useful chanel i am learning c++ from your videos
@SimpleSnippets
@SimpleSnippets 4 года назад
Thank you bro! No need to spend money on fundamentals. There are many resources now a days. Also do checkout my data structures and algorithms course also. You'll love it ✌️
@sauru_6527
@sauru_6527 2 года назад
Bro you helped me a lott tomorrow my PPT presentation is there Thanks for explaining in detail.... 🤗
@nikhiilrajesh3484
@nikhiilrajesh3484 6 лет назад
Great concept explained very well!
@SimpleSnippets
@SimpleSnippets 6 лет назад
+Nikhiil Rajesh hello Nikhil, thank you so much for your positive feedback. Really happy to hear that you liked this video. Please do share the video with your friends and contacts and keep sharing the knowledge 😇✌️
@kanchanabelagam357
@kanchanabelagam357 4 года назад
Simple English made me understand the concept Very nice vedio
@SimpleSnippets
@SimpleSnippets 4 года назад
Thank you so much Kanchana. Glad to hear this feedback from you 😇 Please do share the videos with your friends too 😇
@bardia52
@bardia52 4 месяца назад
I finally learned function templates here, and I couldn't learn it by reading Stroustrup's book! One question: Is there any change to this in C++ 20?
@Deepak_Juluru
@Deepak_Juluru 3 года назад
bro you are really awesome really
@gnarfgnarf4004
@gnarfgnarf4004 2 года назад
This is the first time I have to actually slow down a RU-vid video.
@LokeshWritesCode
@LokeshWritesCode 4 года назад
tomorrow is my sem exam and you helped a lot thankyou
@SimpleSnippets
@SimpleSnippets 4 года назад
That's great to know bro. Please do share the video with your friend too 🤘
@prithvikiranpremkumar9292
@prithvikiranpremkumar9292 2 года назад
Perfect and best content 👌thanks a lot brooooo💥💥💥
@SimpleSnippets
@SimpleSnippets 2 года назад
Thank you bro 👍❤️
@i_write7500
@i_write7500 Год назад
Thank you sirr
@shantanubhute7946
@shantanubhute7946 3 года назад
Tanmay sir Op..!!!
@lituanambochon1312
@lituanambochon1312 6 лет назад
Best video. But you should speak slowly.
@SimpleSnippets
@SimpleSnippets 6 лет назад
Thank you so much for the positive feedback. And yes I'll surely try to slow down a bit. Sometimes I don't realize when I go with the flow about my speed 😅
@alroygama6166
@alroygama6166 5 лет назад
Your slow bro
@v.rprasad5377
@v.rprasad5377 3 года назад
He's passionate. My talking speed is also high when I talk about something I like.
@abdulsattar7878
@abdulsattar7878 5 лет назад
seriously boss, that's two good
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thanks bro 😊 I would request you to please share the video with your friends too ✌️ that'll be the best help ✌️
@dhirajmore321
@dhirajmore321 2 года назад
Luv u sir
@Top_music_oficial
@Top_music_oficial 3 года назад
love you broooooooooooooooo......................, superrrrrrrrr
@asmatafridi4147
@asmatafridi4147 3 года назад
Sir your teaching method is very well but teach it slowly mean your speed is high Thank you
@jayasuryaarul8330
@jayasuryaarul8330 5 лет назад
superb bro💟
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much brother. Please do share the video with your friends ✌️😇
@farhaankhan3354
@farhaankhan3354 4 года назад
Super helpful!
@SimpleSnippets
@SimpleSnippets 4 года назад
Glad it was helpful!
@suryaanshjaiswal50
@suryaanshjaiswal50 4 года назад
this guy is amazing yall
@SimpleSnippets
@SimpleSnippets 4 года назад
Thank you so much bro🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@VigneshwaranSridharanBCE
@VigneshwaranSridharanBCE 5 лет назад
seriously man.! you are the best.!!! :))
@SimpleSnippets
@SimpleSnippets 5 лет назад
Most welcome my friend ♥😇 Your compliments & support means a lot. Please do share the video with our friends too✌
@prakashpandey1090
@prakashpandey1090 3 года назад
amazing video brother
@sgokul5564
@sgokul5564 3 года назад
Thanks for this amazing video.
@SimpleSnippets
@SimpleSnippets 3 года назад
Glad you liked it!
@DevashishJose
@DevashishJose 3 года назад
great video, precise explanation thanks a lot
@nirajmalik0910
@nirajmalik0910 Год назад
The peace at the end 🤦🏻‍♂️🤦🏻‍♂️😂😂
@jamesnash9675
@jamesnash9675 2 года назад
you are the best.......masum
@mashhood7534
@mashhood7534 3 года назад
Really appreciate that 😉
@haniatariq4170
@haniatariq4170 3 года назад
Very excellent explanation ...
@ramchillarege1658
@ramchillarege1658 2 года назад
Excellent!
@luvkumarsharma6139
@luvkumarsharma6139 3 года назад
Simply awesome!!!
@SimpleSnippets
@SimpleSnippets 3 года назад
Glad you liked it! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@lioneldsilva9805
@lioneldsilva9805 4 года назад
it's really good
@SimpleSnippets
@SimpleSnippets 4 года назад
I'm glad you like it. Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@lioneldsilva9805
@lioneldsilva9805 4 года назад
@@SimpleSnippets definetly
@Debugerr
@Debugerr 3 года назад
1000th like
@SimpleSnippets
@SimpleSnippets 3 года назад
Wow ❤️✌️
@heathledger7291
@heathledger7291 4 года назад
keep up the good work
@SimpleSnippets
@SimpleSnippets 4 года назад
Thanks buddy! please do share the video and our channel with your friends too. Thats the biggest help and support 😇
@mohitshinde000
@mohitshinde000 Год назад
Thanks a lot
@kamyagupta4030
@kamyagupta4030 Год назад
thank you 💓
@anup_narvekar
@anup_narvekar 5 лет назад
Very well explained ! Thanks :)
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much bro 😇 please do share the videos with your friends and contacts. That'll be the best help and support for everyone ✌️
@anup_narvekar
@anup_narvekar 5 лет назад
@@SimpleSnippets Don't worry, I'm surely sharing this channel with my friends. ☺️
@SimpleSnippets
@SimpleSnippets 5 лет назад
Thank you so much bro 😇✌️
@tylodevegatate3471
@tylodevegatate3471 2 года назад
Great video as always!
@zameerahmed1775
@zameerahmed1775 2 года назад
Ur too very good at explaining .......... but slower ur pace . U would be awesome
@SimpleSnippets
@SimpleSnippets 2 года назад
Will keep this in mind and work on it 😊
@ajithtechtuts3366
@ajithtechtuts3366 3 года назад
Thanks bro🔥👍👊
@Fuggaaaa
@Fuggaaaa 3 года назад
Thanku❤️🙏🏻
@SimpleSnippets
@SimpleSnippets 3 года назад
Thank you so much buddy. It would mean a lot if you could please share our channel and videos with your friends too ✌
@Fuggaaaa
@Fuggaaaa 3 года назад
@@SimpleSnippets yes...sure.... 😊😊🤗
@liontalha7383
@liontalha7383 4 года назад
What if i want to print the function is of integer type or float type in templates after giving values? template T add(T x, T y) { cout
@dbpmponnou4694
@dbpmponnou4694 2 года назад
thankyou 😃
@kumbhanchoksi8374
@kumbhanchoksi8374 6 лет назад
Thank you sir
@SimpleSnippets
@SimpleSnippets 6 лет назад
You're welcome buddy. Do share the video with your friends too 😇✌️ Also checkout my channel, there's a lot of informational videos you might find helpful 😇✌️
@44mod
@44mod 5 лет назад
Another great video. Again Thank you for your time. I do have a question? I am using code::Blocks and when i make a new .cpp file and close the other files the compiler tries to run the ones that I had closed and not just the one I have open. I am using the same project for all files. The only way I can get it to work right is us /* */ on last file I closed and the new file will run ok. Is there an easier way.
@SimpleSnippets
@SimpleSnippets 5 лет назад
I don't have much of an experience with this IDE. So how about you use dev c++ ✌️
@anup_narvekar
@anup_narvekar 5 лет назад
I have a doubt, consider a function template which adds two numbers, and we want to take in those two numbers from the user, but first we need to store those numbers in some variables, so what should be the return type of those variables ? If we choose the return type as "int" but the user enters a "float" value, then only the integer part of the float data will be stored. So how to make use of templates to detect and store the data type of the entered data ?
@SimpleSnippets
@SimpleSnippets 5 лет назад
The return type should be the generic type (that is - 'T' or any other letter that you use to resemble the generic type) so that the program will automatically consider the type entered by the user at runtime :-)
@anup_narvekar
@anup_narvekar 5 лет назад
@@SimpleSnippets Thanks :)
@SimpleSnippets
@SimpleSnippets 5 лет назад
Most welcome bro 😇✌️keep up the support 😇
@arpanmondal2126
@arpanmondal2126 5 лет назад
If we want to check two nos. Which is greater, if two nos. Are of different data types say int and float then we don't know what will be the return type of the template function. I want to know if this can be achieved then how?
@nashhash4625
@nashhash4625 6 лет назад
Best videos
@SimpleSnippets
@SimpleSnippets 6 лет назад
+Nash Hash hey Nash, thank you so much buddy for such wonderful comments and responses on many of my videos. This really motivates me a lot to make more video tutorials. Keep up the support buddy ✌️😇
@Khan-pf1zc
@Khan-pf1zc 5 лет назад
You are toooo crazey man...
@SimpleSnippets
@SimpleSnippets 5 лет назад
Hehe why so?
@manahilmurtaza974
@manahilmurtaza974 3 года назад
Difference between class & function template??
@naazfatima277
@naazfatima277 3 года назад
Asslam o alaikum sir, mjy aik bt ki smj nu I apny int or double of kese combined Kiya aur float ko miss ku Kiya aur ink nmbrs int double Mila bs .5 ka kese Aya plzz clear soon
@appunair6645
@appunair6645 6 лет назад
nice one bro !!!
@SimpleSnippets
@SimpleSnippets 6 лет назад
Thank you so much buddy. I'm glad you liked the video. Please help me by sharing it with your friends and contacts buddy. That will be the best support for our channel 😋😊
@maverickavanish9240
@maverickavanish9240 5 лет назад
I have one doubt can you please tell me at which stage of compilation it gets handeled? Does this happen at the stage of pre processing?
@sainiguharoy
@sainiguharoy 3 месяца назад
What if the function return type is void?
@sajidsabir6931
@sajidsabir6931 3 года назад
First of all if you explain in Urdu or Hindi it will be good for everyone.. Second thing if we have to read the things which are written on the screen so we can also read it easy the purpose of watching is to get any explanation
@karthik.k8267
@karthik.k8267 6 лет назад
nice bro
@SimpleSnippets
@SimpleSnippets 6 лет назад
+Karthik keyan you're welcome buddy. Happy to hear that you liked this video. Do share the video with your friends and contacts and keep sharing the knowledge 😇✌️
@aratitaradale1352
@aratitaradale1352 6 лет назад
Is it compulsory to use T and U only ? Can we use other than T and U??
@SimpleSnippets
@SimpleSnippets 6 лет назад
No no it's not compulsory to your T or U. You can use any other letter. Small Caps or big. But then you have to use that same character throughout ✌️😇
@aratitaradale1352
@aratitaradale1352 6 лет назад
@@SimpleSnippets thank you 😄
@SimpleSnippets
@SimpleSnippets 6 лет назад
Welcome Arati 😇
@napoleonborntoparty8654
@napoleonborntoparty8654 4 года назад
One question... In my book here it is written template instead of template in function template syntax. Is that the same?
@SimpleSnippets
@SimpleSnippets 4 года назад
Try it :-)
@mohamedrazeen3685
@mohamedrazeen3685 2 года назад
I think its for class template
@he11owthere52
@he11owthere52 4 года назад
I am using turbo c and I am getting an error on the line where template is written and the error is "line 3: , expected"
@jagritbudhiraja6391
@jagritbudhiraja6391 4 года назад
Use 32 bit compilers like Dev and code blocks
@pruthveeshpruthvi8367
@pruthveeshpruthvi8367 3 года назад
Why we are needed to spend money in Udemy if vedios of such good quality are being here like this🙏
@kaoutarru4619
@kaoutarru4619 4 года назад
Then how can i input the parameters?
@rustyrebar9647
@rustyrebar9647 4 года назад
Good video, but you speak too fast and not well articulated!! But the information you give is outstanding!!!
@SimpleSnippets
@SimpleSnippets 4 года назад
Point noted. I will keep this in mind 😇 Thank you for this genuine feedback 😇
@suryakarmakar4240
@suryakarmakar4240 4 года назад
Where did u learner Cpp
@SimpleSnippets
@SimpleSnippets 4 года назад
College, classes then everything online
@suryakarmakar4240
@suryakarmakar4240 4 года назад
@@SimpleSnippets I am an ECE student can u suggest me some online sources
@aakashs1806
@aakashs1806 3 года назад
I have a scenario where I need to have 3 overloaded functions.. double ConvertValues(double dValue); double ConvertValues(char* sValue) double ConvertValues(wchar_t *wValue) For char and wchar_t cases I assume values are coming as string and stored in it, I need to convert it as values and then do appropriate calculation, If double, I can directly send it to the computation.. Can this be done in Function template?
@sarthakmane2977
@sarthakmane2977 3 года назад
Are you marathi?
@SimpleSnippets
@SimpleSnippets 3 года назад
Ho Marathi ahe mi 👍😊
@sarthakmane2977
@sarthakmane2977 3 года назад
@@SimpleSnippets kadakkk bhava! proud of you bhava!
@SimpleSnippets
@SimpleSnippets 3 года назад
@@sarthakmane2977 thank you bhava. Please channel and videos share karat rah. That's the biggest support you can give brother😊👍
@sarthakmane2977
@sarthakmane2977 3 года назад
@@SimpleSnippets nakki bhava😃
@ranjanip3582
@ranjanip3582 2 года назад
Thanks a lot
@vardhanvarma1007
@vardhanvarma1007 4 года назад
Thank you brother
@Gandhiboy
@Gandhiboy 3 года назад
Thank you so much ❤️
@SimpleSnippets
@SimpleSnippets 3 года назад
You’re welcome 😊 Please do share the videos and our channel with your friends if you want to genuinely support me & our channel!✌😇
@praveenmp6781
@praveenmp6781 2 года назад
Thanks 😊
Далее
УГОСТИЛ БЕЛКУ МОРОЖЕНЫМ#cat #cats
00:14
Merab vs Sean underway!! 🚨 #ufc306
00:23
Просмотров 1,2 млн
Class Templates | C++ Tutorial
12:48
Просмотров 48 тыс.
Templates in C++
17:58
Просмотров 590 тыс.
УГОСТИЛ БЕЛКУ МОРОЖЕНЫМ#cat #cats
00:14