Storing the data in a CArray object is an implementation detail that should not be of interest to users of the CDVTestDoc class. This enables the internal implementation of CDVTestDoc to be changed in the future, if necessary. SDI programs create a single document object that is reinitialized each time a new document is opened. This function is provided with some default code inserted by AppWizard. It's a good idea to have your program provide tracing information whenever an interesting event occurs.
Every view is associated with only one document.
When a view must communicate with its associated document, the GetDocument function is used. If the view is created by AppWizard, as CDVTestView is, the GetDocument function returns a pointer to the proper document type. Using GetDocument to fetch a document pointer. In the first part, the document pointer is retrieved using GetDocument . You should always use this macro after an old-style cast to ensure that the pointer is accurate.