1 / 10

5.1 简单数据类 5.2 群体数据类 5.3 数据在文档 / 视图结构程序中的位置

5.1 简单数据类 5.2 群体数据类 5.3 数据在文档 / 视图结构程序中的位置. 为什么要引入通用数据类? 为后续的相同数据结构定义一个统一 的规范; 数据与对数据的操作方法封装到一起. 点类、矩形类、尺寸类、字符串类. 简单数据类. 通用类. 群体数据类. 数组类、链表类、映射类. 5.1 简单数据类. 『1』 点类 CPoint ( Class of Point ). 构造函数. 5.1 简单数据类. 『1』 点类 CPoint. 摘自 MSDN CPoint. 原点. width. X. (left,top).

inga-sims
Download Presentation

5.1 简单数据类 5.2 群体数据类 5.3 数据在文档 / 视图结构程序中的位置

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 5.1 简单数据类 5.2 群体数据类 5.3 数据在文档/视图结构程序中的位置

  2. 为什么要引入通用数据类? • 为后续的相同数据结构定义一个统一 的规范; • 数据与对数据的操作方法封装到一起 点类、矩形类、尺寸类、字符串类 简单数据类 通用类 群体数据类 数组类、链表类、映射类 5.1 简单数据类 『1』点类CPoint (Classof Point) 构造函数

  3. 5.1 简单数据类 『1』点类CPoint 摘自MSDN CPoint

  4. 原点 width X (left,top) 5.1 简单数据类 例 MFCexp5_0 rectangle height 『2』矩形类 CRect (Class of Rectangle) (right,bottom) 屏幕 Y 参考MSDN CRect

  5. 5.1 简单数据类 rectangle initCY 『3』尺寸类 CSize——用于描述一个矩形区域的大小 initCX 摘自MSDN CSize

  6. 5.1 简单数据类 『4』字符串类 CString 1)在C语言中,并没有提供有关字符串类型的数据类型,因此涉及到字符串的操作比较繁琐 2)MFC中将字符串的常见操作封装到CString类中,简化了操作。 例 5-1

  7. CObject Class Template 5.2 群体数据类 实例化 CArray CList CMap Template Class1 Template Class2 MFC提供了动态数组、链表等支持的类类型, 这些类型均在afxtempl.h进行了定义。 这些类都是基于类模板(class template),因此可以实例化为各种模板类 实例化 Object1 Object2 Object3 Object4

  8. 5.2 群体数据类 数组元素的数据类型 CArray class 类成员函数形参的数据类型 template <class TYPE, class ARG_TYPE> class CArray : public Cobject; 如, CArray<CPoint, CPoint&> m_pt;

  9. 5.2 群体数据类 CArray class 例 5-2 1 2 5 3 4

  10. 5.3 数据在文档/视图结构程序中的位置 参见例 5-4

More Related