#Java question help

1 messages · Page 1 of 1 (latest)

vapid kelpBOT
#

<@&987246399047479336> please have a look, thanks.

cold quest
#

not quite sure i get what ur asking for. could u provide some context and elaborate on the question? 🙂

smoky egret
#

He's asking for an ADT that mimics an array probably

brisk parcel
#

So i am currently studying, and one question might be an adt array, the adt array uses inheritance so extends, it also has a copy constructor

quartz wagon
#

an array uses inheritance

brisk parcel
#

i guess i didnt word it well enough

#

all i asked for was an example, but dont worry.

smoky egret
#

Can you give an example of its use?

quartz wagon
#

public abstract class ArrayADT {
protected int size;
protected int[] elements;

public abstract void insert(int index, int value);
public abstract int get(int index);

}

#

abstraction layer for your array where you can define rules

smoky egret
#

Sure, so you're now asking what kind of class would extend this abstract ArrayADT?

#

You could make a SortedArray, or a CircularArray for example.

#

SortedArray always keeps it's elements in sorted order. Circular array could take a index beyond the length of the internal int[] element size.

brisk parcel
#

thank you

#

i just asked chat for an example of what i mean which i did before anyways

#

but it was confusing me