This function works great but is missing one neat feature, the assignment towards members of subclasses (Typically useful when implementing a Model-View-Controller architecture).
Here's a simplified example: 1) Classes used Class CustomerClass CustomerID is int Name is string CityID is int City is a CityClass END
Class CityClass CityID is int CityName is string PostalCode is string CountryID is int Country is CountryClass END
Class CountryClass CountryID is int CountryISOCode is string CountryName is string END
2) Query used to assign to class members Assume we have a query that joins customers with the city table and the country table resulting in a data source with the format: CustomerID | Name | CityID | CityName | PostalCode | CountryID | CountryISOCode | CountryName
3) Array used MyArray is array of 0 CustomerClass
4) Now we assign this query result to the array of CustomerClass objects using the FichierVersTableau(MyArray, MyQuery) function. This would unfortunately only assign the members at the level of the Customer Class instance and not the members of the subclass City instance and the subsubclass Country instance limitating this feature in real life OO scenario's. |