Are int, char also an Abstract Data Type?

I want to know that are all primitive data types in C, C++ and Java are Abstract Data Types because their implementations are hidden.

And one more thing:

I want to ask is if an ADT has two parts of Abstract View (all the functions that can be operated on it) and implementation view (how functions and data type are implemented). Then how I can create an ADT in C++??

As in java, abstract view can be implemented using Interface while Implementation view is implemented using class.

Answer

Think of Abstract versus Concrete (The term concrete here is mine for illustrative purposes.

An abstract class cannot be created, a concrete class can. when you inheretit from an abstract class and define all the abstract methods, it is now concrete.

since you can instantiate an int it is not abstract, but rather concrete

It is not that an implementation is hidden that makes it abstract, it is that it is is yet to be defined.

If you have an abstract base class, then some of the functionality must be defined by its children. Visibility is irrelevant. You cannot inherit from int it is a POD (plain old data) type

In C++ std::string has a visible implementation, in java, part of it is hidden (thats why + can be used to concatenate strings in Java)

Leave a Reply

Your email address will not be published. Required fields are marked *