1、简单型 Template-Based Classes使用时需要指定参数
CArray<type, arg_type> CList<type, arg_type> CMap<type, arg_type>
其中type用来指定你希望收集的对象的类型(int,float或者其他C++的类),arg_type则用来指定函数的参数类型。例如:
CArry<int ,int> m_intArray;
m_intArray.Add(15);
表示需要一个int数组,且该数组成员函数(如Add)的参数为int。
2、指针类型型的Template-Based Classes
CTypedPtrArray<base_class, type>
CTypedPtrList<base_class, type>
CTypedPtrMap<base_class, type>
其中type用来指定你希望收集的对象的类型(int,float或者其他C++的类),base_class则用来指定基类,它可以是任何用来收集指针的non-template collection classes,例如CObList,CObArray,CPtrList或CPtrArray等等,例如:
CTypePtrList<CObList, CSrock*> m_strokeList;
CStroke* pStrokeItem = new CStroke(20);
m_strokeList.AddTail(PStrokeItem);
表示我们需要一个派生自CObList的类,用来管理一个链表,该链表的组成部分为CStroke*。
3、简单型 Template-Based Classes 是CObject的子类,而指针类型型的Template-Based Classes则是独立的类。
4、CList和CArray下面都有诸如CObList和CPtrList之类的子类,Ob表示派生自CObject的任何对象,Ptr表示对象指针。
CArray<type, arg_type> CList<type, arg_type> CMap<type, arg_type>
其中type用来指定你希望收集的对象的类型(int,float或者其他C++的类),arg_type则用来指定函数的参数类型。例如:
CArry<int ,int> m_intArray;
m_intArray.Add(15);
表示需要一个int数组,且该数组成员函数(如Add)的参数为int。
2、指针类型型的Template-Based Classes
CTypedPtrArray<base_class, type>
CTypedPtrList<base_class, type>
CTypedPtrMap<base_class, type>
其中type用来指定你希望收集的对象的类型(int,float或者其他C++的类),base_class则用来指定基类,它可以是任何用来收集指针的non-template collection classes,例如CObList,CObArray,CPtrList或CPtrArray等等,例如:
CTypePtrList<CObList, CSrock*> m_strokeList;
CStroke* pStrokeItem = new CStroke(20);
m_strokeList.AddTail(PStrokeItem);
表示我们需要一个派生自CObList的类,用来管理一个链表,该链表的组成部分为CStroke*。
3、简单型 Template-Based Classes 是CObject的子类,而指针类型型的Template-Based Classes则是独立的类。
4、CList和CArray下面都有诸如CObList和CPtrList之类的子类,Ob表示派生自CObject的任何对象,Ptr表示对象指针。