Passing an array of floats to a class
in
Programming Questions
•
3 years ago
There has to be a cleaner way to pass a whole array to a function in a class. But I'm passing this:
like this:
- float[] geoParams = { 52.992884, 52.970146, -1.194592, -1.151333 };
like this:
- walks[i] = new Coord(geoParams[0], geoParams[1], geoParams[2], geoParams[3] );
to the Coord function (inside a class):
- Coord(float l, float r, float t, float b) {
which works in a clunky, literal way. But I really want to pass the whole array:
- walks[i] = new Coord(geoParams);
to the Coord function and use it like this:
- Coord(float params) {
- mapGeoLeft = params[0];
- mapGeoRight = params[1];
- mapGeoTop = params[2];
- mapGeoBottom = params[3];
Any ideas?
1
