How do you pass data in a structure to a function defined in a template class.(Just like the case for primitive types int char or even arrays.)
I mean:
if you have:
template<class T>
class node{
T data;
int size;
public:
node()
{
size = 0;
}
void insert(T data);
}
it is possible to make the following declaration in the main program :
int main()
{
node<int> s;
node<float> q;
.
.
.
}
so that T can accept int or char values;
Now suppose I had data from this struycture:
struct student{
int ID;
char name[25];
}
How would I use some template fuction to pass such data to it and possibly be able to create a list ?
thanx every body.
Nkabirwa Sowed Magezi
nkabirwa@yahoo.com
A Ugandan Developer for
(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97
(2)Debt onitoring System(DMS) - Ms-Acess 97
(3) The Loans Recovery System(LS) - Ms- Access 97
(4) The Dry Cleaners System(DS) - Ms- Access 97
I mean:
if you have:
template<class T>
class node{
T data;
int size;
public:
node()
{
size = 0;
}
void insert(T data);
}
it is possible to make the following declaration in the main program :
int main()
{
node<int> s;
node<float> q;
.
.
.
}
so that T can accept int or char values;
Now suppose I had data from this struycture:
struct student{
int ID;
char name[25];
}
How would I use some template fuction to pass such data to it and possibly be able to create a list ?
thanx every body.
Nkabirwa Sowed Magezi
nkabirwa@yahoo.com
A Ugandan Developer for
(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97
(2)Debt onitoring System(DMS) - Ms-Acess 97
(3) The Loans Recovery System(LS) - Ms- Access 97
(4) The Dry Cleaners System(DS) - Ms- Access 97