From what I understand, an abstract data type is basically some data and what we are allowed to do with that data (ex. a list with a set of data and an attribute size
and the functions get()
, set()
, sort()
, insert()
and remove()
. It's an abstract data type because we do not know what the data inside is going to be or how get()
, set()
, sort()
, insert()
and remove()
are going to be implemented. Is this basically the same thing as an interface? for example in C++
template <typename T>
class List{
private:
int size;
T* data;
public:
T get(int index) = 0;
void set(int index) = 0;
T remove(int index) = 0;
void sort() = 0;
void insert(T obj) = 0;
};
would List
here be considered an abstract data type? Also what if the attributes are hard typed like in the following class?
class Person{
public:
string name;
int age;
string gender;
};
Thanks