Overloading the operator -=:
RentACar& operator-=(const Automobile& av)
In RentACar i have a dynamically allocated array of Automobile *a
So lets say that if any a
has the same a.brand
with av.brand
then that a should be removed and the allocated memory freed for one object.
I thought sth. like if it doesnt find an object with the same brand it return *this, but if it does, it allocates space for a new automobile array of size of a-1, assigns objects of, skips the one with the same brand, but i dont know how to write it.
I don't know how to write with vectors and push back, anyway, i study for an exam and we never used vectors for whatever reason so i can't use them on the exam so i must do this even if it is a stupid implementation!
Thanks!