I have a class, which has an object of another class in it.
Like this:
1 2 3 4 5
class parking
{
char adresa[50];
int cena;
vozilo *voz;
Now I have to write an operator that prints out all the VOZ'es that are contained in the 'parking' class. But I don't know how many VOZ-es are there.
The exercise asks to create an object of VOZILO inside the class PARKING, and create an += operator that adds new VOZ'es.
And then create a OSTREAM operator, that prints all the VOZ'es. But as I don't know the exact number, I've no idea how to do this ://
The exercise says that there is a maximum of 500voz'es to be added, but what if not all of them are filled? maybe only 10will be added?
if this is correct, that this should be acceptable in the exam, cause the one you mentioned surely won't, we haven't learned about those yet, so I can't use them.