Coupon Accepted Successfully!


Abstract Data types

C is not object-oriented, but we can still manage to inject some object-orientedprinciples into the design of C code. For example, a data structure and its operations can be packaged together into an entity called an Abstract data type. There’s a clean,simple interface between the abstract data type and the program(s) that use it.

Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details.

Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation.


Now, if we talk in terms of C++ Programming, C++ classes provides great level of data abstraction. They provide sufficient public methods to the outside world to play with the functionality of the object and to manipulate object data, i.e., state without actually knowing how class has been implemented internally.

Access Labels Enforce Abstraction:

In C++, we use access labels to define the abstract interface to the class. A class may contain zero or more access labels:

  • Members defined with a public label are accessible to all parts of the program. The data-abstraction view of a type is defined by its public members.
  • Members defined with a private label are not accessible to code that uses the class. The private sections hide the implementation from code that uses the type.

Designing Strategy:

Abstraction separates code into interface and implementation. So while designing your component, you must keep interface independent of the implementation so that if you change underlying implementation then interface would remain intact.

In this case whatever programs are using these interfaces, they would not be impacted and would just need a recompilation with the latest implementation

Test Your Skills Now!
Take a Quiz now
Reviewer Name