What is document-view architecture? Give me one real time example for SDI?
 


Answer:

A MFC application is created using different classes. Each of the class has given a distinct responsibility.

1. Frame window class - Represents the application window.

2. View class- Represents the data to the user in specific understandable format.

3. Document class – Represents the applications data.( Program data used by application during its execution).

MFC architecture allows user to represent the data as documents in different views (formats ex. Charts, tabular, textual). View(s) are attached to the application frame window.

SDI Example: Let us say we have a application with name MySDI..

In SDI application we have following major classes derive.

CMySDIApp-Application class derived from CWinApp.

e) CMainFrame - Frame Window class derived from CFrameWnd

f) CMySDIView - View class derived from CView (Can have multiple classes)

g) CMainDoc - Document class derived from CDocument.

Above three classes are bind together using a Template class called as CSingleDocTemplate.