Even in 2020 it's still a gem .....and it's brightness we'll never fade ....bcom more and more with period of time......lov ur work sir......bssss aawaj bht km aata kafi dikkt hoti h😬😬😬 pr phir bhi life iz good with this🤓🤓🤓🤓🤓🤓🤓💎💎💎💎💎💎
I have never subscribed any indian channel before.. but i admired you as my teacher so i subscribed your channel for the very first time. awesome tutorials ..(y)
for anyone having the return type doubt.. here is the answer #include using namespace std; template auto big(X a,Y b) { return (a>b)?a:b; } int main() { cout
The decltype(a + b) in the big() function declaration is used to infer the return type of the function. The decltype keyword takes an expression as its argument and returns the type of that expression. In this case, the expression is a + b, so the return type of the big() function is decltype(a + b). This is necessary because the big() function is a template function, which means that it can be used with any type of data. The compiler needs to know the type of the return value in order to generate code for the function. The decltype keyword allows the compiler to infer the return type of the function, even if the type of the arguments is not known at compile time. For example, if you call the big() function with the arguments 4 and 5.8, the compiler will infer that the return type of the function is double because 5.8 is a double. However, if you call the big() function with the arguments 4 and "hello", the compiler will infer that the return type of the function is std::string because "hello" is a std::string. The decltype keyword is a powerful tool that can be used to infer the type of expressions at compile time. This can be useful for a variety of tasks, such as inferring the return type of functions and determining the type of variables.
x class,here data type of both variable are different and we don't know which value is greater ,we have to return maximum value of a and b as same data type which is alloted . so which value data type we have to write before class(return type)
Ya you can not write x or y there. You have to return the type of that who can accept answer of both datatype after the operaton, between x and y. Here is example... template T1 big(T a,T1 b) { if(a>b) b=a; return b; } int main() { cout
First of all Thank you Sir for making these wonderful series! sir i have a doubt that if i am doing like ... template then how can i decide return type either X or Y of my function. Thanks in advance!!
I think ek naya placeholder banana chahiye aur woh function ke return type me likh dena chahiye jiski wajah se jis tarah ka value function return krega usstype ka placeholder ban jayegaa I think yeh zyada useful hogaa
For another type of value we add another class as class Y but while declaring function... X funct_name (X a, Y b) or we can type Y funct_name (X a, Y b).
1. Make two template function using a C++ template function concept. FIRST TEMPLATE FUNCTION: First template function will find a specific value from a one dimensional array. You should pass the array itself, array size and as well as the searching value for the argument of the function. Name the function as search_value. The function will return “FOUND” if value matches with any value of the array otherwise it will just send “NOT FOUND”. SECOND TEMPLATE FUNCTION: Second template function will find the second max value from a one dimensional array. You should pass the array itself and array size for the argument of the function. Name the function as second_max. The function will return the second largest value from the array. MAIN FUNCTION: In the main function create 3 separate arrays each one for integer, double and character data type and initialize them with some values. Now for all of them find a specific value and also find the second largest value. What will be the Code for this?? Kindly Tell me sir
For pure virtual function and other concept also you given a example but you have to give example with programming and declair a variable also with the function and like a private public protected variable also declair and explain properly
Saurabh Shukla Sir can u plz explain me this { Main function will return value where....Like in a normal function value is returned from where it is called but who is calling main function!}. int main() { }
If we are using two different type of place holder for a float and int argument then which value will be returned by seeing the fact that the function returning value is X. ???
wow sir, you are great.... i haven`t understood concept of template in class but you make understand...i like your teaching way... its great... sir do you have the tutorial for uml and data base management system... if you have tutorial it would be great....
Awsm work.... You made my confidence top of the world...........waiting for more videos of data structure in c++ plzzzzzzzzzz upload sooon.... it really help us lot... Charan Pranam... "Guru Ji......." u r fantastic....
it depends on what you need to return... if you want to return int ---- use placeholder of int ---- X if you want to return double ---- use placeholder of double ----- Y Ex: - X big(X a, Y b) 9 big(4, 5.6) ---- as X in argument --- you pass an int 4 -- so return int 9 Y big(X a,Y b) ---- as Y in argument --- you pass a double 5.6 -- so return double 9.6 9.6 big(4, 5.6) NOW some has questions like if i take X big(X a, Y b) 9 big(4, 5.6) -- now clearly from argument, X is int and Y is double -------- return type X --- so int 9 9.6 big(5.6, 4) ----- but here X is double and Y is int -------- return type X --- so double 9.6 soln:-no need to take different placeholder template X big(X a, X b) 9.6 big((double)4, 5.6) 9.6 big(5.6,(double)4) 9 big(4, (int)5.6) 9 big((int)5.6,4)
What if return type of function is not known as we don't know what will he the result in the body of function, then should we take another placeholder for it?
Sir isme, function ki return type se koi problem nhi hoga kya, aapne X li ha to.... Agar float vaali bddi value hui to Ye to int type ki return ker dega..... This is data loss....
It is very helpful!! I like all of your tutorials. But i have found that many of the tutorials have only the Part1 available. Like this video "Lecture 20 Template in C++ Part 1 Hindi", there is only one part. Can you please upload the Part 2 of all the tutorial sessions? so that we could know more details!! Anyway thanks your great effort!! :)
Video uploaded 5 years ago , students still learning from it . Power of free online education .
After 7 years
@@ShivaniSharma-ng8cq yes...
@@ShivaniSharma-ng8cq yes
Sir is an IIT an
Not free it's quality content😅
The whole topic was uploaded 8 year ago but... the playlist is best among all the playlist...❤❤❤❤❤
Dada big fan 😂😂
@@jeetbanerjee6686 Ram Ram bro ❤️🍀
still watching your videos in 2019..lots of love sir ji
Even in 2020 it's still a gem .....and it's brightness we'll never fade ....bcom more and more with period of time......lov ur work sir......bssss aawaj bht km aata kafi dikkt hoti h😬😬😬 pr phir bhi life iz good with this🤓🤓🤓🤓🤓🤓🤓💎💎💎💎💎💎
This video's are gem except for few codes which needs needs some modifications and libraries to be included
2022
We r watching this in 2022 may.
✌️
Legends watching in 2022 🤣🤣
Ur way of clearing out the concepts is salutable. Thanks
kya baat h sir g itne sare articles padh liye mene bt apne ik hi video me simply sare doubts clear kr diye thnkuuu so much
Love , respect and appreciation from Pakistan, he is really a master !!!👍👍👍
Kuch alag level pe hi simple kar diya hai aapne concepts ko
sir this video is awesome!! understanding templates from book is so difficult...you've describe it quite amazingly...
What are you doing ❤❤
sir u are just awesome ....are u teacher in any IIT,nit or gives only online lectures...
I have never subscribed any indian channel before.. but i admired you as my teacher so i subscribed your channel for the very first time. awesome tutorials ..(y)
What are you doing ❤❤
Ap nay buht achy say smjhaya hai, function template, Sir Awesome
for anyone having the return type doubt.. here is the answer
#include
using namespace std;
template auto big(X a,Y b)
{
return (a>b)?a:b;
}
int main()
{
cout
Thank you 🤗
Thanks! Can't we put there?
What's the use of auto here anyways?
Bhalaiiiiiii.. ki supplyyyyyyyyyy... chaluu rakhna..... Guru ji.... God Bless U... for that kind of work...
2021 and this tutorial is still better than.. many other tutorial on youtube
The decltype(a + b) in the big() function declaration is used to infer the return type of the function. The decltype keyword takes an expression as its argument and returns the type of that expression. In this case, the expression is a + b, so the return type of the big() function is decltype(a + b).
This is necessary because the big() function is a template function, which means that it can be used with any type of data. The compiler needs to know the type of the return value in order to generate code for the function. The decltype keyword allows the compiler to infer the return type of the function, even if the type of the arguments is not known at compile time.
For example, if you call the big() function with the arguments 4 and 5.8, the compiler will infer that the return type of the function is double because 5.8 is a double. However, if you call the big() function with the arguments 4 and "hello", the compiler will infer that the return type of the function is std::string because "hello" is a std::string.
The decltype keyword is a powerful tool that can be used to infer the type of expressions at compile time. This can be useful for a variety of tasks, such as inferring the return type of functions and determining the type of variables.
Yes bro.. that's what i was wondering. thank you
next level teaching sir...🔝
sir mine cpp class Ki h phir b template kya hota h Abbi tk pata nhi tha. lekin aap ke lecture se 2min. me clear Ho gaya.
thank u so much sir...
explaining very well by taking superb, fantastic real-world examples.
x class,here data type of both variable are different and we don't know which value is greater ,we have to return maximum value of a and b as same data type which is alloted . so which value data type we have to write before class(return type)
Sir ap bhot accha pdate h ab to programing easy lgne lgi h
I have a question when there are two arguments of different types
Then we make two type x, y but what about return type . It will still x ??
Diksha mujhe bhi same doubt hey kya apko iska answer milla ki return type me X likhe ya dono X,Y likhna hey
Same doubt
Ya you can not write x or y there. You have to return the type of that who can accept answer of both datatype after the operaton, between x and y. Here is example...
template
T1 big(T a,T1 b)
{
if(a>b)
b=a;
return b;
}
int main()
{
cout
Here is a solution ⬇️
#include
using namespace std;
template
int big(x a,y b)
{
if(a>b)
{
cout
@@padhaiparcharcha iska return type to humesha int hi rhega bhai 😶😶
Thank you very much. You are a genius.
Aapko jitna thanks kare kam h keep doing this great job sir😊☺
💞🇮🇳💞 Sir Your Teaching Mehod Outstanding, Brilliant, Excellent
First of all Thank you Sir for making these wonderful series!
sir i have a doubt that if i am doing like ...
template
then how can i decide return type either X or Y of my function.
Thanks in advance!!
I have the same question & I am a beginner please tell me answer of this question
sir your videos are really best for all programmers.thank you so much....keep uploading sir
I think ek naya placeholder banana chahiye aur woh function ke return type me likh dena chahiye jiski wajah se jis tarah ka value function return krega usstype ka placeholder ban jayegaa
I think yeh zyada useful hogaa
one of the best teacher in my life....
For another type of value we add another class as class Y but while declaring function...
X funct_name (X a, Y b) or we can type
Y funct_name (X a, Y b).
your videos are too useful ..i understand every topic easily just because of your awesome videos.. thank you so much sir ..
NITISH SINGH Thanks for the appreciation dear
Top Notch
Sir your way of teaching is very best
1. Make two template function using a C++ template function concept.
FIRST TEMPLATE FUNCTION:
First template function will find a specific value from a one dimensional array.
You should pass the array itself, array size and as well as the searching value for the
argument of the function. Name the function as search_value.
The function will return “FOUND” if value matches with any value of the array
otherwise it will just send “NOT FOUND”.
SECOND TEMPLATE FUNCTION:
Second template function will find the second max value from a one dimensional array.
You should pass the array itself and array size for the argument of the function. Name the
function as second_max.
The function will return the second largest value from the array.
MAIN FUNCTION:
In the main function create 3 separate arrays each one for integer, double and character
data type and initialize them with some values.
Now for all of them find a specific value and also find the second largest value.
What will be the Code for this??
Kindly Tell me sir
Do u have code !?
Excellent sir 👌
thank u sir for this amazing video...my doubt is cleared after watching your video
u r my all time favourite teacher......glad to hv u🙂
What are you doing ❤❤
Sir your videos is very useful .no other teacher can not explain.
What are you doing ❤❤
after 8 years and 5 months it is still worthy...
Nehi sir suggestion zaroorat nhi hai! Aap to itna mast samjhate ho!
For pure virtual function and other concept also you given a example but you have to give example with programming and declair a variable also with the function and like a private public protected variable also declair and explain properly
Awesome Lecture 👍
Thank you sir 🙏
can u plz upload a video for class template also.
sir u r really doing a great job .plz cover all topics of c++
thanx.
Amazing explanation sir...i liked, shared it
Sir your explanation way is very cool and nice
template
X big( X a, Y b)
sir isme a and b dono alag data type hai, jo bada hoga uska return type kaise decide hoga jo big k pahle likha hai
very helpfull for us.........thank you sir........keep it up
Awesome way of explaing .And i beleive almost all the college students teaches from suarbh sukla.sir instead of college teacher.
Thank you so much sir for great explanation.
Goodd
ek number sir kya sika the hu really head off to u ...
+prashant mudaliyar head off ....i mean are u serious
namespace is not a predefined library in c++, it is a keyword provides methods for preventing name conflicts
that methods for preventing name conflicts is predefined in library of c++ so it is.
He knows what will come in our mind
ua-cam.com/channels/u4ztYtW-Bg1KIfcLAULtVQ.html
SUBSCRIBE this Channel for Data Structure
Saurabh Shukla Sir can u plz explain me this { Main function will return value where....Like in a normal function value is returned from where it is called but who is calling main function!}.
int main()
{
}
@@rituraj7318 operating system will call main function
Explained very well. Sir you are awesome.
Sir hats off to you for this wonderful explanation : )
What are you doing ❤❤
Sure this lecture is useful for desired people.
Thank you sir
What are you doing ❤❤
this information is very helpfull for me thanku so much sir..
Thanks for making this topic so simple
Bohot badiya coursera par bi itna badia nahi bataya tha jitna yaha bataya hai
If we are using two different type of place holder for a float and int argument then which value will be returned by seeing the fact that the function returning value is X. ???
Thanks Sir. Love the way you teach.
even after 7 years this vid is a reason why students can still pass their exams lol
wow sir, you are great.... i haven`t understood concept of template in class but you make understand...i like your teaching way... its great... sir do you have the tutorial for uml and data base management system... if you have tutorial it would be great....
+Ruben Gurung Very soon DBMS videos will be uploaded
Awsm work.... You made my confidence top of the world...........waiting for more videos of data structure in c++
plzzzzzzzzzz upload sooon.... it really help us lot... Charan Pranam... "Guru Ji......." u r fantastic....
brother where are you now? what was you experience about mysirg....please share
awesome this feature reduces a lots of work
Thank you so much sir your lectures are very helpful
this lecture is very nice sir .........................thanku sir but some time your use the marker it was not too good to understand
Awesome video
Thank you sir for very good explanation.
you are too good. cann't wait for the upcoming clearification.
thank u sir
upke a bala tuitorial mayray ko a6i lage
upka sabhe tuitorial a6a hy
from saurabh bakshi
kolkata, west Bengal
if using two diffrent type of argument in same function the template ,but in the return type of function is "x" ??
Yaa, I also have the same question.
Ritik Kumar correct bro i also gave the same question
it depends on what you need to return...
if you want to return int ---- use placeholder of int ---- X
if you want to return double ---- use placeholder of double ----- Y
Ex: - X big(X a, Y b)
9 big(4, 5.6) ---- as X in argument --- you pass an int 4 -- so return int 9
Y big(X a,Y b) ---- as Y in argument --- you pass a double 5.6 -- so return double 9.6
9.6 big(4, 5.6)
NOW
some has questions like if i take X big(X a, Y b)
9 big(4, 5.6) -- now clearly from argument, X is int and Y is double -------- return type X --- so int 9
9.6 big(5.6, 4) ----- but here X is double and Y is int -------- return type X --- so double 9.6
soln:-no need to take different placeholder
template
X big(X a, X b)
9.6 big((double)4, 5.6)
9.6 big(5.6,(double)4)
9 big(4, (int)5.6)
9 big((int)5.6,4)
if we dont know which value will return, user will inout the value, in that case what we will
do
X just act as generic data type
nice presentation
keep it up
well done sir
Its really helpful Sir. Thank you so much!
Excellent
Sir if we use 2 place holder in same program then what will be it's return type
Sir you explained very well.thank you.may you live long and prosper
What are you doing ❤❤
Main function will return value where....Like in a normal function value is returned from where it is called but who is calling main function!
Nice explanation sir
Thank you so much sir 🙏🤗
Very simply explained i like the content sie
U just nailed it sir🙏
thanks sir❤❤
sir pls upload lucture on class templates also. very clear and concise explanation
Sir ji big fan. U are my inspiration 😍
Thanks a lot Sir.
Please upload second part of template.it's very helpful.
Very useful video 👍
superb👍👍👍👍👍
Your explanation is amazing
What if return type of function is not known as we don't know what will he the result in the body of function, then should we take another placeholder for it?
Sir isme, function ki return type se koi problem nhi hoga kya, aapne X li ha to.... Agar float vaali bddi value hui to Ye to int type ki return ker dega..... This is data loss....
Very nice lecture!
It is very helpful!! I like all of your tutorials. But i have found that many of the tutorials have only the Part1 available. Like this video "Lecture 20 Template in C++ Part 1 Hindi", there is only one part. Can you please upload the Part 2 of all the tutorial sessions? so that we could know more details!! Anyway thanks your great effort!! :)
Navid Bin Anwar I left scope for part-2 in future
ok... thanks for your reply :)
11:28 you said we can create more than one place holder but you're return X type what if the return value is of Y type then
Awesome sir
Sir...outstanding video !! love you
watching in 2020
good work
Simply awesome