1 / 50

ADTs and C:

ADT's, a review. We've learned that it is often necessary to develop new data types for our programming, and we develop ADT's.In C , an ADT is constructed using the class construct.Classes contain public and private information, and can have sections so labeled.. ADT's, a review. The public sect

chuck
Download Presentation

ADTs and C:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. ADT's and C++: A Review

    2. ADT's, a review We've learned that it is often necessary to develop new data types for our programming, and we develop ADT's. In C++, an ADT is constructed using the class construct. Classes contain public and private information, and can have sections so labeled.

    3. ADT's, a review The public section contains the interface to the ADT. It consists of a set of functions called methods. Two special types of methods exist and should always be declared: constructors and destructors. Other methods provide the basic ability to examine and manipulate objects of the new Abstract Data Type.

    4. ADT's, a review The private section contains the basis for the implementation the ADT. It usually contains variables, constants and structures necessary for the implementation. This private information is only visible to and accessible by the ADT itself; applications using the ADT can't see this information or refer to it in any way.

    5. ADT's, a review The class definition is placed in a header file which we call the ADT definition header. The ADT definition header should be included by any source or header file that needs to use the ADT in question. The ADT definition header should also be included by the ADT definition source file, which implements all of the methods of the ADT.

    6. ADT's, a review When creating a project that uses the ADT, the ADT definition header should be placed in the list of project header files. The ADT definition source file should be placed in the list of project source files.

    7. ADT's, a review Putting all of this together, we arrive at the following two files: IntStack.h and IntStack.cpp.

    8. ADT's, a review

More Related