In the previous chapters we have examined how Handle and ADT may be used to implement an encapsulated custom C data type which consists of primitive C data types only. In the upcoming chapters we will investigate how existing encapsulated custom C data types may be used to assemble a new, also encapsulated, custom C data type.
We will distinguish three ways in which a whole - a new encapsulated custom C data type - may absorb its parts - previously constructed encapsulated custom C data types:
An integral is a part that must be permanently embedded in a whole - created in the same block of memory. By its definition a life time of an integral part is equal to that of it containing whole.
A non-integral owned is a part that does not have to be permanently embedded in a whole but its life time has to be equal to that of it containing whole nonetheless. In this context "owned" means that a whole still has to manage this part's life cycle by creating and deleting it.
A non-integral rented is a part that does not have to be permanently embedded in it containing whole and its life time is of no consequence to that whole. In this context "rented" means that a whole completely ignores the fact that a pointer to some variable is a (permanent) part of its definition.
A whole can and usually does employ any combination of the above membership types. A part, on the other hand, should participate in one type of membership only. Concrete requirements at hand determine the appropriate membership type.
\(\blacksquare\)