lundi 25 janvier 2016

What are invalid statments in following C++ template program?

1)Can I pass more than one arguments of different datatypes to to the same function when I use template

 template <typename T> T func(T a,T str)
{
    T strx=str+'x';
    return strx;
}
int main()
{
    int a=10;
    int x;
    string str="hai";
    str=func(a,str);
    cout<<x;
    return 0;

}

Aucun commentaire:

Enregistrer un commentaire