To make or construct an abstract model or software model of a collection it is started by building the formal specification and the first component of this is the name known as data type - type of objects which belong to the collection class. In C programming, we use typedef to define a new type that is a pointer to a structure:
typedef struct collection_struct *collection;
We are showing a pointer to a structure only, we have not defined details of the attributes of the structure. We are deliberately deferring it and the details of the implementation are irrelevant at such stage. It is only concerned with the abstract behavior of the collection. In actuality, we want to be able to replacement different data structures for the real implementation of the collection, depending on needs.
The typedef declaration provides with a C type or class in OO design parlance, collection. We can state objects of type collection where needed. Although C forces us to expose that the handle for objects of the class is a pointer, This is better to take an abstract view, we look upon variables of type collection simply as handles to objects of the class & forget that the variables are actually C pointers.
Tags: Data Structure, Assignment Help, Homework Help
Comments
Post a Comment