1.

Why Do We Separate Interface From Implementation?

Answer»

The INTERFACE is visible to the user of the class and consists of public members, which are usually member FUNCTIONS. The class user reads and modifies values in data representation by CALLING public member functions. The interface is generic in that it is not bound to any particular implementation.

The implementation of a class, which consists of private data members and private member functions, is essentially hidden from the program. The implementation defines the details of how the class implements the behavior of the abstract BASE type. The class author should be able to CHANGE the implementation without affecting the program.

The interface is visible to the user of the class and consists of public members, which are usually member functions. The class user reads and modifies values in data representation by calling public member functions. The interface is generic in that it is not bound to any particular implementation.

The implementation of a class, which consists of private data members and private member functions, is essentially hidden from the program. The implementation defines the details of how the class implements the behavior of the abstract base type. The class author should be able to change the implementation without affecting the program.



Discussion

No Comment Found