answersLogoWhite

0

An abstract data type (ADT) exists purely to provide a common interface to all the objects that may be derived from it, without providing the full implementation of that interface. It is a concept rather than an actual object.

For instance, an Animal object is a fairly general class of object, while Cat and Dog are specific types of Animal. It does not make sense to allow users to create an instance of Animal, since it would impossible to provide an implementation for every type of animal that that class could possibly represent.

For instance, all animals make a noise, so it makes sense for the Animal class to have a MakeNoise() method. But we cannot implement this method since the Animal class would have to determine what type of animal it actually was before it could produce the correct sound. Animals simply do not do this in real life: a dog does not ask itself whether it is a cat or a dog before deciding that it should bark rather than meow!

So we declare Animal to be an ADT by making the MakeNoise() method pure-virtual. We can then derive a Cat object from our Animal ADT and implement the MakeNoise() method within the Cat object. We can do the same for the Dog class, a Mouse class, an Elephant class, and so on. Each specific object knows what sound it must make.

Since all these specific classes are derived from a common ADT, the Animal class, we can create collections of animals, without regard to their specific type. When we call an animal's MakeNoise() method, a Cat object will meow while a Dog object will bark, the Mouse will squeak and the Elephant will Trumpet. We've effectively called a general method but got a specific method instead, without having to work out which specific method to call.

That is the essence of all ADTs; by creating a new data type from an ADT, we can provide a specific implementation for an already existing common interface. Clients of the ADT (such as a queue or stack) needn't know what data types it contains, nor what data types it could contain in the future because they already know the common interface of the ADT. If you decide you want a lion in your queue, derive one from the ADT and the client won't care: the MakeNoise() method will make the lion roar!

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

What is different between primitive date type and non primitive data type in c plus plus programming language?

A primitive data type is built into the language - int, char, long, etc. A non-primitive data type is am abstract data type that is built out of primitive data types - linked list, queue, stack, etc.


Is built-in data-type are abstract data-types in java?

All built-in data types are not abstract data types.


What is called representation of data structure in memory?

"Abstract Data Type"


What is the type of class for which objects can not be created except the static member?

Abstract data types or abstract base classes.


Do Abstract data type increases the complexity of program or reduces the complexity?

Decreases.


Representation of stack data structure in c plus plus?

Stack is an abstract data type that allows you to input and output data in a way that the first data which was placed in the stack will be the last one to get out. We use physical examples of stack in our daily lives such as the stack of dishes or stack of coins where you only add or remove objects from the top of the stack. You can see the implementation in c++ in related links, below.


What are the examples of data type?

quantitative and qualitative


What is true about true about abstract data type Object of an abstract class type cant be created. We can derive classes from these abstract classes Object of an abstract class t?

True - an instance of an abstract class cannot be created. False - derive (subclass) from a class, not the object (the instance).


What are abstract data types?

Abstract Data Types An Abstract Data Type (ADT) is a data type that has been created by a programmer – i.e., it is not built-in in the programming language. As any other data types, an ADT is composed of a domain (the set of values belonging to the data type) and a collection of operations to manipulate such values. The only difference is that such data type will be constructed by the programmer. When we build an ADT we really want to apply the principles of encapsulation and information hiding mentioned earlier. This means that, once we have finished building the data type, we wish others to use the data type exclusively through the operations we provide, and in no other way. In particular, to protect our implementation and guarantee the ability to evolve software, we want to ensure that the implementation of the ADT is hidden from other users.


What is an abstract data structure?

Abstract Data Type in computing is a set of data along with a set of predefined operations.The actual data inside the ADT is protected from direct manipulation. The exposed operations is the only way to manipulate the data.In easier terms, it is very much like (though not limited) to the objects in object oriented programming.


What is the difference between data structure and abstract data type?

An Abstract Data Type is an interface that interacts with a data structure. A Data Structure is an implementation of the ADT. for example. If you were going to create a linked list you would create an Interface listing all the methods required by the list. Then in the linked list class you would code how the list uses these methods. Hope this helps :)


What is an abstract datatype?

Abstract data typeA mathematical entity consisting of a set of values (the carrier set) and a collection of operations that manipulate them. For example, the Integer abstract data type consists of a carrier set containing the positive and negative whole numbers and 0, and a collection of operations manipulating these values, such as addition, subtraction, multiplication, equality comparison, and order comparison.AbstractionTo abstract is to ignore some details of a thing in favor of others. Abstraction is important in problem solving because it allows problem solvers to focus on essential details while ignoring the inessential, thus simplifying the problem and bringing to attention those aspects of the problem involved in its solution. Abstract data types are important in computer science because they provide a clear and precise way to specify what data a program must manipulate, and how the program must manipulate its data, without regard to details about how data are represented or how operations are implemented. Once an abstract data type is understood and documented, it serves as a specification that programmers can use to guide their choice of data representation and operation implementation, and as a standard for ensuring program correctness.Above retrieved from Answers.comViper1