Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ADT and Classes?

ADT is the set of operations. ADT's are mathematical abstractions.

Does this mean that ADT are same as classes or am i confusing both together ?

like image 541
ajknzhol Avatar asked Feb 02 '14 16:02

ajknzhol


People also ask

What is the only real difference between an ADT and a class?

As an example, a Stack ADT defines the basic stack operations like push and pop (but says nothing of how these operations should be implemented), while a Stack class would use either a linked-list or an array to actually implement these operations.

What is the difference between an ADT and a class in C ++?

What is the difference between an ADT and a class in C++? In an ADT, the user does not have access to the implementation details. applies to the entire file. If you have a class defined in separate files, and change the way a class is defined, which files need to be re-compiled?

Why are classes called ADT?

Explanation: Since classes use the concept of data abstraction therefore they are known as Abstract data types (ADT).

Is a class an example of ADT?

When a class is used as a type, it is an abstract type that refers to a hidden representation. In this model, an ADT is typically implemented as a class, and each instance of the ADT is usually an object of that class.


1 Answers

The key to the difference is abstract. Think of an ADT more like an interface - a class with only method declarations, no implementation details.

As an example, a Stack ADT defines the basic stack operations like push and pop (but says nothing of how these operations should be implemented), while a Stack class would use either a linked-list or an array to actually implement these operations.

like image 82
Bernhard Barker Avatar answered Sep 28 '22 02:09

Bernhard Barker