Difference between Abstract Data Types and Objects
1. Abstract data type (ADT) :
An Abstract data type (ADT) is a mathematical model for data types. We can think of Abstract Data Type as a black box. As black box hides internal structure, ADT hides the design of data type. An abstract data type’s behavior (semantics) can be specified from the perspective of a data user, specifically in terms of potential values, potential operations on this type of data, and the behavior of these operations. It is user defined data type.
It is a conceptual abstraction defined that represent data and data operations. Abstract Data Types are concerned with what, not how (they are expressed decoratively, and they do not specify algorithms or data structures). Examples include lists, stacks, queue, and sets.
2. Objects :
Objects are not the only way to achieve abstraction. It implements procedural data abstraction, as known by many. Abstract data types approach abstraction in a different way. When we define a class, no memory is allocated but when we instantiate (i.e. An object is created) memory is allocated.
An object is an instance of a class, with its own copy of any non-static variables.
Difference between Abstract Data Types and Objects : Abstract Data Type Objects Objects have states and behaviours Test t = new Test();.
Abstract data type is abstraction that define set of values and set of operations on these values. It is a self-contained component which consists of methods and properties to make certain type of data useful. User-defined data type. It is an instance of class. ADT is made of with primitive datatypes. An object is an abstract data type with the addition of polymorphism and inheritance. It is a type (or class) for objects whose behaviour is defined by a set of value and a set of operations. It is a basic unit of Object-Oriented Programming. Abstract datatype is not necessarily an OOP concept. Objects is an OOP concept. Common examples include lists, stacks, sets, etc. Allocate memory when data is stored. When we instantiate an object then memory is allocated.
Abstract Data Type
Objects have states and behaviours
Test t = new Test();.
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.