Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an abstract data type in object oriented programming?

What is an abstract data type in object oriented programming? I've gone through the wiki for this topic, but I am still unclear about it. Could someone clarify?

like image 765
sevugarajan Avatar asked Nov 07 '09 12:11

sevugarajan


People also ask

What is an abstract data type example?

Abstract Data Types are focused on what, not how (they're framed declaratively, and do not specify algorithms or data structures). Common examples include lists, stacks, sets, etc. ADTs provide a way for us to formally define reusable modules in a way that is mathematically sound, precise, and unambiguous.

Why object is abstract data type?

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.

What are the types of abstract data types?

There are two types of models in the ADT model, i.e., the public function and the private function. The ADT model also contains the data structures that we are using in a program.

What do you mean by abstract data?

Data abstraction is the reduction of a particular body of data to a simplified representation of the whole. Abstraction, in general, is the process of removing characteristics from something to reduce it to a set of essential elements.


2 Answers

An abstract class is a generalization concept. It is a class you invent to only use as a base class for inheritance but not to instantiate objects from.

And abstract datatype (ADT) is not necessarily an OOP concept. It is an older term to describe the concepts of for example Stack and Queue in terms of their functionality, without describing the implementation.

like image 72
Henk Holterman Avatar answered Sep 21 '22 19:09

Henk Holterman


There is a difference between an "abstract data type" and an "abstract class".

An abstract class is one that may not have definitions for all the methods it defines. You therefore cannot directly instantiate an abstract class. You have to create a subclass and then instantiate that.

An abstract data type is a model of a certain kind of data structure e.g. a Stack. A Stack has push() and pop() operations and that have well-defined behaviour.

The abstract data type (ADT) itself refers to this model, not any particular implementation in any particular programming language or paradigm. You could implement a Stack in an object-oriented language, but you could also implement it in a functional programming language.

ADTs allow discussion about the properties of Stacks, Queues etc that hold for all correct implementations of the ADT.

like image 34
ctford Avatar answered Sep 21 '22 19:09

ctford