问题一:类的静态指针类型的属性初使化

//test.h

class Test

{

...

public:

  static WORD* m_test;

...

}

 

//test.cpp

#include "test.h"

WORD* Test::m_test = 0;

...

 

问题二:类中的模板方法

类中的模板方法不能在cpp中实现,可以在h文件中定义时即实现:

//test.h

class Test

{

...

public:

  template<class T>

  BOOL TestMethod(T& result)

  {

    result = ...;

    return TRUE;

  }

...

}

 

以上两问题如出现均会出现linker错误

相关文章: