当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
C++学习中遇到的两个问题
发布时间:2010/5/17 11:21:01 来源:城市学习网 编辑:ziteng
  问题一:类的静态指针类型的属性初使化
  //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错误
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved