I have created a structure of different data types and i want to return each type of data. does this can be done using a function template which takes a different data argument not included in structure or no arguments?
I have something like this,
struct mystruct{
int _int;
char _c;
string _str
};
In function template(int i)
{
mystruct s;
switch (getInput)
{
case 1:
return s._int;
case 2:
return s._c;
case 3:
return s._str;
}
}
void main()
{
int getInput = 1;
//pass getInput value to function template
}