While reading for c++
, I came across, derived data types such as array
, struct
, unions
etc. However we also study about stacks
, queues
, binary search tree
, trees
as ADT
.
I wonder, are these ADT
derived datatypes too?
Arrays, structs, unions or pointers are derived types that C++ inherited from C. They allow to create new data types from basic types (int
, long
, float
...).
In C++ you also have the Standard Template Library (STL), which are abstract types. They differ from derived types in that they are classes that use templates.
So, answering your questions, abstract types are more powerful than derived types because the template mechanism has richer semantics. For instance, in C++ you can have an abstract struct:
template <typename T>
struct mytype {
T value;
};