I made the code using structure, wanted to know if classes would be more efficient. I'm doing it in C ++ Builder. The idea of the code is as follows: create a list of problems, where during the execution of the code will be added and removed numerous problems (type struct
or class
)
struct {
TList *cidadesvisitadas; // lista iniciada com uma cidade ,vou acrescentando ate 30 cidades
float distancia;
TList *cidadescanditadas; // lista iniciada com 29 cidades , que no decorrer do codigo vai sendo retirada uma a uma e adicionada na lista de cidades visitadas
};
In the list of problems, an initial (unresolved) problem will be added, and then removed this problem turns into three new (unresolved) problems that are added back to the list of problems, then I take a problem back from the list of problems and turns into three other problems and so on. The list at the end of the run is empty (adds and removes, when the problem is resolved it does not return to the list). Problems already stuck dynamically (they will be millions of problems)
if I change the struct
(Problem) to class
(Problem), is the code more correct?