answersLogoWhite

0


Best Answer

Abstract data types are the opposite of a concrete data types. An abstract data type is one that does not contain all of the function code necessary to create an instance of the object. This design allows subclasses to implement the abstract functions while inheriting the non-abstract functions of the class. A pointer to an abstract instance can call all the abstract functions of that object, which will defer their execution to the actual concrete data type's implementation of that function. As a simple example, an abstract class ChessPiece might have a function called move(). A Pawn subclass would behave differently than a Queen would, but both could be called by outside code without knowing (or caring) about what type of ChessPiece is moving.

Correction

Abstract classes can provide a full and complete (if generic) implementation for all of their pure-virtual functions. It is not the lack of a complete implementation that renders them abstract, but the fact the methods were declared pure-virtual and therefore cannot be inherited. However, derived classes can still call those implementations from within their own implementations.

Furthermore, derived classes that do not provide implementations for all the pure-virtual methods become abstract base classes themselves. But the pure-virtual methods that they do implement can then be inherited through multi-level inheritance.

Non-inheritance of pure-virtual methods only applies to the class that initially declared the method as pure-virtual. Provided an implementation is declared protected or public within a derived class, that implementation can then be inherited by a concrete class, or it can be overridden if required.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

In C++, an abstract data type is a class that must be derived into a child class. It is not possible to instantiate an abstract class. Another way to define this is to say that an abstract class contains pure virtual functions or that it inherits from a class with pure virtual functions but does not provide an implementation for them.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

An abstract data type is an abstract base class, a class which declares one or more pure-virtual methods. You cannot instantiate an abstract base class other than by deriving an object from the class. The derivative must provide the implementation for the pure-virtual methods it inherits otherwise it also becomes and abstract data type. Once an implementation is provided, the method reverts to a virtual function, which can then be inherited by more specific derivatives. However, only derivatives that provide or inherit a complete implementation can actually be instantiated. The purpose of an abstract data type is to provide a common interface to all its derivatives, much like a standard base class, but where the class is conceptual rather than actual. For instance, a shape is a conceptual class whereas circles and squares are actual classes.

Data abstraction is often confused with data hiding, however data abstraction simply refers to the way in which it is not necessary to know the internal details of an object in order to use an object. Nothing is actually hidden, it's just that there's no need to know. Data hiding is actually a function of binary libraries and other executables where information is obfuscated by the machine code.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

If you mean basic data types as in intrinsic types (such as char, int, bool, short, long, etc) then no, they are not abstract. They are primitives.

Standard template library (STL) types such as list, queue, vector, etc, are abstract data types since they can be constructed from any existing type (primitive or user-defined, including other abstract types) in order to provide a container for that type.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

An abstract data type (ADT) is a class that has one or more pure-virtual functions. Even if the ADT provides a default implementation for its pure-virtual methods, you cannot instantiate an object from an ADT, you must derive a class from it and provide a specific implementation. If a derived class does not fully implement the pure-virtual functions, it becomes an ADT itself, but subsequent derivatives can inherit any implementations it does provide.

An ADT is a conceptual object rathar than an actual object, and is intended to provide a common interface to all of its derivatives. Calling a pure-virtual method implicitly upon an ADT will invoke the most-derived class method, thus ensuring the expected behaviour of the derivative via the common interface.

An ADT is also known as an abstract base class (ABC).

An example of an ADT is a shape class. A shape class may have size (a bounding rectangle) and a position member, as well as a draw method, but a shape cannot draw itself because a shape is conceptual. Circles and squares are actual shapes, so they can both inherit from the shape class and implement the Draw() method accordingly. And since all shapes have a common ADT, collections of different shapes can be created, regardless of their actual type. Calling the Draw() method on any ADT in the collection will invoke the Draw() method in the square or circle, whichever is appropriate for that particular shape. That is, the caller doesn't need to know what the actual shape is, it only needs to know that every shape has a Draw() method -- the fact it is a pure-virtual method is immaterial to the caller. As far as the caller is concerned, it has a collection of shape ADTs and every shape has the ability to draw itself.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

An abstract data type is any class or struct that contains at least one pure virtual function.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

No. Abstract datatypes in C++ are classes which declare one or more pure-virtual functions. Basic datatypes are primitives and are therefore not classes, and thus are not abstract datatypes.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Yes, C++ has data types.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is abstract data type in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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.


User defined data type in c plus plus?

Use "typedef" : both in C and C++.


Can an integer data type in c plus plus stores character value?

no


What use of void data type in c plus plus?

doesn't return the value.


What is difference between '1' and 1 as for us a computer is concerned with respect to c plus plus?

When you type '1' in a C++ program, it is considered to be of character data type(char). When you type 1, it is considered to be of integer data type.


What are logical classes in c plus plus?

There is no such thing. Logic is bitwise operation, not a data type.


What Lead to C C plus plus and java?

(C and Lisp, ... data type") was adopted by many later languages, such as ALGOL 68 (1970), Java, and C#. ... C++ has a separate Boolean data type ( 'bool' ), but with automatic conversions from ... "Report on the Algorithmic Language ALGOL 68


How do C and C plus plus differ in terms of data abstraction and classes and structs?

They differ insofar as C does not use object-oriented programming at all -- there are no classes (only structures), therefore there was nothing to abstract. C++ (which literally means 'the successor to C') is an extension of C that primarily adds object-orientated support to the language. Everything you can do in C you can also do in C++, but with the added benefits of OOP you can do a whole lot more, more easily, including the creation of abstract data types.


What is the difference between class data type and basic type in c plus plus .How can someone know which one is class type and which one is basic type.?

Basic types (primitive data types) have no methods associated with them.


What are the abstract datatypes in c plus plus?

Class Object Message


Defference between c plus plus and c?

these are difference in between c and c++: a) C is a SPL and C++ is a OOP. b) C has not concept of object but C++ has this feature. c) C has not 'class' name data type but C++ has.


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.