类模板分离编写
main
#include <iostream>
#include "类模板分离编.hpp"
using namespace std;
void text01()
{
pront<int> p(123,123);
p.Show();
}
int main()
{
text01();
return 0;
}
类模板分离编.hpp
#include "类模板分离编.h"
template<class T>
pront<T>::pront(T a, T b)
{
this->mAge = a;
this->mName = b;
}
template<class T>
void pront<T>::Show()
{
cout << "" << mAge << endl;
cout << "" << mName << endl;
}
三级标题
#pragma once
#include <iostream>
#include <string>
using namespace std;
template <class T>
class pront
{
public:
pront(T a,T b);
void Show();
public:
int mName;
int mAge;
};