Computer Science Canada **template class** |
| Author: | JessT0 [ Mon Mar 15, 2004 9:21 pm ] | ||||
| Post subject: | **template class** | ||||
Anyone know how to convert this to template ?please help given:
here what i did
note: the program has to have 3 instantiation of this class with type char,int,double.Create a pair for each of these types, print them,increment them,and then reprint them.Thank for reading |
|||||
| Author: | wtd [ Mon Mar 15, 2004 10:23 pm ] | ||
| Post subject: | |||
|
|||
| Author: | JessT0 [ Wed Mar 17, 2004 11:17 am ] |
| Post subject: | |
Thank wtd did you compile this program?i compiled it and it doesn't work... |
|
| Author: | wtd [ Wed Mar 17, 2004 7:12 pm ] | ||
| Post subject: | |||
The following fixes the typos and other errors.
|
|||
| Author: | JessT0 [ Thu Mar 18, 2004 11:48 am ] |
| Post subject: | |
thank to Wtd alot. i got what you talking about.One more question:For the print and increment, I believe my instructor wants you to use operator overloading instead of creating a normal function. Do you have any idea for that?i'm really appreceate. |
|
| Author: | wtd [ Thu Mar 18, 2004 3:19 pm ] | ||
| Post subject: | |||
JessT0 wrote: thank to Wtd alot. i got what you talking about.One more question:For the print and increment, I believe my instructor wants you to use operator overloading instead of creating a normal function. Do you have any idea for that?i'm really appreceate.
That's what the following functions are doing:
|
|||
| Author: | JessT0 [ Sat Mar 20, 2004 9:23 am ] |
| Post subject: | |
One last question.Can we use print(),increment() functions which already have in there instead of using operator++(),operator++(int) and "cout" ?. Last time i just wanna say thank you very much for your help,this really helpfull.Have a good weekend |
|
| Author: | wtd [ Sat Mar 20, 2004 3:28 pm ] | ||||
| Post subject: | |||||
You can use them, but with the overloaded operators, you don't really have any reason to. Which would you rather see?
Or:
|
|||||
| Author: | JessT0 [ Sun Mar 21, 2004 11:46 pm ] |
| Post subject: | |
thanks ,i get it now |
|