To implement its functionality, the MFC is organized as a hierarchical tree of classes, the ancestor of which is CObject:
Although you can create C++ classes for your applications, most of the classes you will use throughout our lessons descend directly or indirectly from CObject.
The CObject class lays a valuable foundation that other classes can build on. Using the rules of inheritance, the functionality of CObject can be transparently applied to other classes as we will learn little by little. Some of the features that CObject provides are:
- Performing value streaming for saving or opening the contents of files
- Controlling dynamic creation and destruction of its inherited classes
- Checking the validity of variables of classes, etc
You will hardly use CObject directly in your program. Instead, you may create your own classes that are based on CObject. Here is an example:
class CCar : public CObject { public: CCar(); char *Make; char *Model; int Year; long Mileage; int Doors; double Price; };
- To make sure that this application uses MFC, on the main menu, click Project -> Properties...
- In the left list, click Configuration Properties
- In the right list, click User of MFC, click the arrow of its combo box and select Use MFC In A Shared DLL
- Click OK
Comments
Post a Comment