I created a method which deletes a pointer from a array of pointers and then moves all the subsequent pointers one position to the left. This is the code I wrote:
1 2 3 4 5 6 7 8 9 10 11
void EU::deleteElement(Dogs *ar[],int index, int length){
//ar: array of pointers
//index: index of the element to be removed
//length: length of the array
for (int i = index; i <length-1; i++){
ar[i] = ar[i+1];
}
}
My problem is that now I want to do the same with an array of pointers which do not point to Dog objects but to different objects, let's say Computers. Is it any way to create in C++ a function wich works with all the different classes:
void EU::deleteElement(GLOBAL_CLASS *ar[],int index, int length){
or my only solution is to create the same method but for the class Computers.