Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
MFC Collection Classes - Trần Anh Tuấn A presents about Introduction, Example Array; Introduction, Example List; Introduction, Example Map. This lesson helps people who professional in information technology and person like this. | MFC COLLECTION CLASSES Trần Anh Tuấn A CONTENTS ( MFC COLLECTION CLASSES ) ARRAY Introduction : MFC Provides an assortment of array classes for users ARRAY Type-Specific MFC Array Classes ARRAY Sample : CStringArray ARRAY Sample : CStringArray ARRAY CStringArray Class Members ARRAY Generic CArray Class A template class used to build type-safe array classes for arbitrary data types, such as array of CPoint Users can use data of any kind—even classes of your own creation—in CArrays template parameters Example : Create an array of CPoint : CArray array; Create an array of SinhVien : CArray array; array.SetSize(10); Array.Add(SinhVien(“Tran Van Huy”,”0411255”,”Nam”); CArray variable ARRAY Example : EXAMPLE : STEP 1 SinhVien.h SinhVien.cpp Note: must make class Dialog to be a friend of class SinhVien to access SinhVien data (Hoten and MSSV) EXAMPLE : STEP 2 Class Winzards Collection Demo Dialog CollectionDemoDlg.h . | MFC COLLECTION CLASSES Trần Anh Tuấn A CONTENTS ( MFC COLLECTION CLASSES ) ARRAY Introduction : MFC Provides an assortment of array classes for users ARRAY Type-Specific MFC Array Classes ARRAY Sample : CStringArray ARRAY Sample : CStringArray ARRAY CStringArray Class Members ARRAY Generic CArray Class A template class used to build type-safe array classes for arbitrary data types, such as array of CPoint Users can use data of any kind—even classes of your own creation—in CArrays template parameters Example : Create an array of CPoint : CArray array; Create an array of SinhVien : CArray array; array.SetSize(10); Array.Add(SinhVien(“Tran Van Huy”,”0411255”,”Nam”); CArray variable ARRAY Example : EXAMPLE : STEP 1 SinhVien.h SinhVien.cpp Note: must make class Dialog to be a friend of class SinhVien to access SinhVien data (Hoten and MSSV) EXAMPLE : STEP 2 Class Winzards Collection Demo Dialog CollectionDemoDlg.h CollectionDemoDlg::OnInitDialog() EXAMPLE : OUTPUT LIST A linked list is a collection of items that contain pointers to other items ( Next and Prev pointer). The MFC template class CList implements a generic linked list that can be customized to work with any data type POSITION : A value used to denote the position of an element in a collection; used by MFC collection classes LIST Sample : CObList Construction CObList Constructs an empty list for CObject pointers. Head/Tail Access GetHead Returns the head element of the list (cannot be empty). GetTail Returns the tail element of the list (cannot be empty). Operations RemoveHead Removes the element from the head of the list. RemoveTail Removes the element from the tail of the list. AddHead Adds an element (or all the elements in another list) to the head of the list (makes a new head). AddTail Adds an element (or all the elements in another list) to the tail of the list (makes a new tail). RemoveAll Removes all the elements from this list. LIST .