...

/

Consequences of the First-Class ADT pattern

Consequences of the First-Class ADT pattern

In this lesson, we will explain the consequences of applying the First-Class ADT pattern.

Copy semantics

As clients only use a handle, which we have declared as a pointer, to the ADT, the issue of copy semantics boils down to pointer assignment. While efficient, in terms of run-time performance, copies of a handle have to be managed properly. The handles are only valid as long as the real object exists.

In case we want to copy the real object and thus create a new, unique instance of the ADT, we have to define an explicit copy operation.

Dependencies managed

With the interface Customer.h , the C language guarantees us that the internals of the data structure are encapsulated in the implementation with no possibility for clients to access the internals of the ...