C++模板类

C++模板类

#include  < iostream >
#include 
< string >
using   namespace  std;

template
< typename Ta >
class  CFoo
{
public :
    
void  showTa();

    template
< typename Tb >
    
void  showTb(Tb tb);

};


template
< typename Ta >
void  CFoo < Ta > ::showTa()
{
    
//
}


template
< typename Ta >
template
< typename Tb >
void  CFoo < Ta > ::showTb(Tb tb)
{
    cout 
<<  tb.c_str() <<  endl;
}
int  main(){

    CFoo
< int >  foo;

    
string  tb( " abc " );
    foo.showTb(tb);
    
return   0 ;
}

你可能感兴趣的:(C++模板类)