//类成员函数模板特化
#include <stdio.h>
class A{
public:
    template <class T>
    void Print(){
        printf("A template\n");
    }
};

template<>
void A::Print<int>(){
    printf("int\n");
}

int main(){
    A a;
    a.Print<double>();
    a.Print<int>();
    return 0;
}

 

相关文章:

  • 2021-12-24
  • 2022-12-23
  • 2021-05-25
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
猜你喜欢
  • 2021-05-25
  • 2022-01-02
  • 2021-12-06
  • 2021-12-01
  • 2021-09-25
  • 2021-07-30
相关资源
相似解决方案