23.6. Navigating app, doc, and view

We’ve already discussed how MFC uses the Document-View architecture in Chapter 5: Software Design Patterns. This section fills in a little more information about how we can navigate among the app, the doc and the view.

In MFC you can always get there from here. But the pathways are a little oddly marked. Table 23.2 lists the code to use to get a pointer to the classes listed in the top row from inside a method belonging to class in the left column.

The ::AfxGetApp() is a global MFC function, by the way; we write the ‘:: ’ in front of it to remind ourselves that it’s a global function rather than being a method of any particular class.

The access methods in the fine print look kind of unpleasant. In reality, ...

Get Software Engineering and Computer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.