65,211
社区成员
发帖
与我相关
我的任务
分享#pragma once
#include <string>
#include <iostream>
template <typename T>
class root
{
public:
void show();
T t;
};
#include "root.cpp"#include "stdafx.h"
#include "root.h"
template <typename T>
void root<T>::show()
{
std::cout<<"root show"<<std::endl;
}#include "stdafx.h"
#include "root.h"
int _tmain(int argc, _TCHAR* argv[])
{
root<int> r;
r.show();
return 0;
}
#ifndef ROOT_H_
#define ROOT_H_
#include <string>
#include <iostream>
template <typename T>
class root
{
public:
void show();
T t;
};
#endif
#include "root.h"
template <typename T>
void root<T>::show()
{
std::cout << "root show" << std::endl;
}
int main()
{
root<int> r;
r.show();
return 0;
}
#pragma once
#include <string>
#include <iostream>
template <typename T>
class root
{
public:
void show();
T t;
};
//#include "root.cpp"
#include "stdafx.h"
#include "root.cpp"
int _tmain(int argc, _TCHAR* argv[])
{
root<int> r;
r.show();
return 0;
}
#pragma once
#include <string>
#include <iostream>
template <typename T>
class root
{
public:
void show();
T t;
};
template <typename T>
inline void root<T>::show()
{
std::cout<<"root show"<<std::endl;
}