[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Buckys C++ Programming Tutorials – 60 – class Templates
by
Tags:
Comments
36 responses to “Buckys C++ Programming Tutorials – 60 – class Templates”
-
Thanks Bucky Roberts.
-
Can we write the bigger function inside the class ?
-
when you choose the data type that represents T in your template, can it be another class?
-
This is great, thanks.
-
thank u sho much sir i really appreciate u . i salute u
-
thanks you very much. this tutorials helping me so much. hahahahahahah
-
Isnt the whole point of template was to use generic int,double etc types. Now with this <int> we have to pass integers only. Cant we pass mixed type arguments like the previous video?
-
the problem that you dont show nor explain this should be .hpp only calss and why and also that you dont have to implement the bodu function outside the class cause you must do it in the same class anyway in generic classes so you also showing the hard way to do it
-
Thanks a lot Bucky you can't imagine how all your videos help me a lot.
-
@1:54 – You should make use of the member initialization list, since your template could very well allow for data types that are not "Plain Old Data" and they are not static. It's more intuitive and is faster for user defined types.
-
Pretty cool huh !
-
Why can't I define the function within the class?
-
thank you so much!
-
I never saw a "?"-Operator
-
You are so freindly bucky….thankx
-
Why the function T Bigger ( ) can without a "friend" to use the variables in class Bucky?
-
cant "forget about it" when i gotta do a final exam on it
-
Explain plz what category are "first" and "second" variables of type T in your template class?
Usually, in all last classes you aways explicitly point on which type of category of function objects you are dealing with – private, public or protected. So what is first, second?
Since you didn't specify it here, I am confused.) -
I still don't see the difference from using templates and using the type, "auto".
-
the line "Bucky <int> doesn't make any sense coz template is used to handle any datatypr right???
-
You sound like NightBlu3 haha
-
You've added so much value! Thank you!
-
This is almost more trouble than it's worth.
-
So to date I have been able to follow your tutorials quite well and see the materials application to a real system. However, with this tutorial I am at a loss?
We've defined our own class to allow for any data type to enter the function, an attribute I would have thought was used because we don't know the data type in advance? Yet in using the function we have to specify the data type? Not only this but the functions return type is also defined by the first pass in argument?
This to me seems irrelevant unless we define a third generic data type to be used as the return type of the function?
I guess what I am asking is, firstly, will using a third generic data type allow us to obtain the full return value of the larger number (say we compared 45 and 62.54?). Secondly, is there away to use the function without having to specify the datatype of the input parameters during the function call?
Any help would be appreciated.
-
couldn't we initialize the variables in the constructor?
-
Can anyone tell me what compiler software being used? I am new to learning C++ and this seems like a very handy tool.
-
If one parameter is int and other is double at line:21 then?
like Bucky <int> bo(258, 105.5); Should i write like <int , double> ? -
Would be nice to see an explanation in several examples of a practical usage of T in C++ at class level.
-
I have a question.?
what is <class T> : generic class or generic data type ..?
because bucky use the term interchangeably.! -
Shouldn't the line " T first, second; " be bellow a access specifier as in:
Class Bucky{
Private:
T first, second;
Public:
Bucky()etc… -
Hello!
I have understand how to create function and class templates. Also I have understand why we can use function templates (to avoid function overloading and making our job easier). But still couldn't figure out the concept behind the "Class Templates". Why are we using them? Can someone please explain me?
Thank you very much!
-
6:27 – using 69 and 0x69 🙂
-
But we just can't go ahead and add the body that would be too easy and this is C++.
-
are angle brackets only used for templates? it seems like there is alot left unexplained even if this is the case. Like he never says why you have to type in class; after a quick search it appears there is things i never heard of that you can pass into the angle brackets after template.. like this template <typename T, size_t N> . Then it is followed to make a structure lol. I think typename and size_t are already made objects in the guys code tho.
-
he says he doesnt know why you have to write template twice, but he doesn't say why you have to write void and int and such twice, so i imagine the same rules apply. In order for class T to work, the template keyword must be used, since otherwise, T is not a valid data type. The template keyword seems to only work for one data type under it, which is why it can only be used for the class data type below it, then it must be called again to be used for the function definition.
Leave a Reply