百度首页 | 百度空间
 
查看文章
 
CTypedPtrList <CObList, CStudent*
2008年04月24日 星期四 03:24 P.M.
2、增加CStudent类来描述学生:CStudent类的属性有:
CString m_sCode;
CString m_sName;
CString m_sSex;
CString m_sBirth;
CString m_sTel;
CString m_sAddr;
并为CStudent类添加一个构造函数。
3、在文档类中加入成员变量:
     POSITION    curPos;
CTypedPtrList <CObList, CStudent*> m_dataList;
int index; //当前记录的序号,注意:在使用iSum和index之前要刻在构造函数里初始化
int iSum; //记录总数
其中CTypedPtrList 类是一个模板类,其定义格式如下:
CtypedPtrList<BASE_CLASS,TYPE>
其中TYPE用来指定你的列表元素的类型;例如int ,char,long ,float, 或为类和结构。
BASE_CLASS用来指定CTypedPtrList 类的基类。
CObList类支持指向Cobject派生类的对象的有序的指针列表。
为了能在应用程序中使用CTypedPtrList,在文件stdafx.h中
#include <afxtempl.h>

类别:编程 | 添加到搜藏 | 浏览() | 评论 (1)
 
最近读者:
 
网友评论:
1
2008年04月24日 星期四 03:25 P.M.
http://cache.baidu.com/c?m=9d78d513d99207e41abac23c4b56893d581297634d868d45218fd20e84642a100620a4ed707e5610948522685be90f1efdf1456f2a417df6dddf883d8de8c97e689f27432141d95c46c418db920e32c0569a59e9ad1de7bd&p=c9769a46dc9b11a05af685364641&user=baidu
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu