Are int, char also abstract data type?

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

One more thing:

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

As in java, an abstract view can be implemented using an interface, while an implementation view can be implemented using a class.

+3


source to share


1 answer


Think abstract and concrete (the term concrete is here for my purposes.

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

since you can instantiate int

it is not abstract but rather concrete



It's not that the implementation is hidden, which makes it abstract, but it's not yet defined.

If you have an abstract base class, then some of the functionality must be defined by its children. Visibility doesn't matter. You cannot inherit from int

, this is a POD type (plain old data)

C ++ std::string

has a visible implementation, in java part of it is hidden (that's why + can be used to concatenate strings in Java)

+5


source







All Articles