64,282
社区成员
发帖
与我相关
我的任务
分享
template <typename TYPE_INFO>
class CTypeInterface
{
public:
template <typename TYPE_INFO>
void Analyze()
{
};
template<>
void Analyze<int>()
{
};
public:
CTypeInterface()
{};
virtual ~CTypeInterface()
{};
private:
virtual void Analyze(int iCount) = 0;
};
class CTypeDerive:
public CTypeInterface<RECT>
{
public:
using CTypeInterface::Analyze;
private:
virtual void Analyze(int iCount)
{};
public:
CTypeDerive()
{};
virtual ~CTypeDerive();
};
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
CTypeDerive derive;
derive.Analyze();//这里编译会出错,提示error C2660: 'CTypeDerive::Analyze' : function does not take 0 arguments
return 0;
}
#include "stdafx.h"
template <typename TYPE_INFO>
class CTypeInterface
{
public:
template <typename TYPE_INFO>
void Analyze()
{
};
template<>
void Analyze<int>()
{
};
public:
CTypeInterface()
{};
virtual ~CTypeInterface()
{};
private:
virtual void Analyze(int iCount) = 0;
};
class CTypeDerive: public CTypeInterface<int>
{
public:
using CTypeInterface::Analyze;
public:
virtual void Analyze(int iCount) {};
public:
CTypeDerive() {};
virtual ~CTypeDerive(){};
};
int _tmain(int argc, _TCHAR* argv[])
{
CTypeDerive derive;
derive.Analyze<int>();
return 0;
}
#include "stdafx.h"
template <typename TYPE_INFO>
class CTypeInterface
{
public:
template <typename TYPE_INFO>
void Analyze()
{
};
template<>
void Analyze<int>()
{
};
public:
CTypeInterface()
{};
virtual ~CTypeInterface()
{};
private:
virtual void Analyze(int iCount) = 0;
};
class CTypeDerive: public CTypeInterface<int>
{
public:
using CTypeInterface::Analyze;
public:
virtual void Analyze(int iCount) {};
public:
CTypeDerive() {};
virtual ~CTypeDerive(){};
};
int _tmain(int argc, _TCHAR* argv[])
{
CTypeDerive derive;
derive.Analyze(0);
return 0;
}
template <typename TYPE_INFO>
class CTypeInterface
{
public:
void Analyze()
{
};
public:
CTypeInterface()
{};
virtual ~CTypeInterface()
{};
private:
virtual void Analyze(int iCount) = 0;
};