S
spider
Hi Guys
I am planning to design a sorting class which will sort different data
types like int ,float,double,char
User will be given option
Enter the data:
So he can enter any data like {1 234 456 57} or {a d f t b y}
For this i am using template class,now the problem is that how to
create objects of template class based on the data type entered by
user.
For example if user enters data {1 234 456 57} then sort<int> s;
and if user enters data {a d f t b y} then sort<char> s;
One way to decide is we can take sizes of datatypes entered by user and
based on that we can create different objects.
Any other ways we can do that????
I am planning to design a sorting class which will sort different data
types like int ,float,double,char
User will be given option
Enter the data:
So he can enter any data like {1 234 456 57} or {a d f t b y}
For this i am using template class,now the problem is that how to
create objects of template class based on the data type entered by
user.
For example if user enters data {1 234 456 57} then sort<int> s;
and if user enters data {a d f t b y} then sort<char> s;
One way to decide is we can take sizes of datatypes entered by user and
based on that we can create different objects.
Any other ways we can do that????