That makes a lot of sense, I was missing the setCarArray(newCarQuantity); function for the tempDealer.
Onto the
This is deleting the vector I pass in main?
edit:
Yeah the use of vectors here would instrumentally more beneficial but sadly its required.
when I try to use the other type of ctor I get this type of error
|
(.text+0x749): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `tempDealer()'
| |
edit: I think this is because it tries to interpret it as a function. My mistake
edit 2:
I think I now know what I was doing wrong, I added this
1 2 3 4 5 6
|
for (int k = 0; k < vec.size(); ++k) {
if(vec[k].getDealerNumber() == newCarToDealer){
Dealer tempDealer(vec[k].getDealerName(),vec[k].getDealerNumber(),vec[k].getNumberOfCars());
Car tempCar;
Car *cars = vec[k].getCarArray();
| |
whats funky now is the for loop has interesting errors with how it deals with multiple cars being added. But you helped me realize what my issue was!
What would the line look like to not overwrite the car array but add to it?
I'm hesitant to use vec.push_back(); because I am not adding another dealer, simply cars to the array. Would I still use vec.push_back()?
Marking issue as resolved, thank you a ton. I genuinely learned a lot about pointers and references through all this.