Overloading function with different return type

Viewed 4057

I have two functions with the same name and the main difference is just different return type. How could I overload the function in order to use the same name because sometimes I need point3d or point3f arrays, and the following function names gives error for being the same:

public static Point3d[] GetNGonCenters(this Mesh mesh)
{
    Point3d[] centers = new Point3d[mesh.Ngons.Count];

    for (int i = 0; i < mesh.Ngons.Count; i++)
        centers[i] = mesh.Ngons.GetNgonCenter(i);

    return centers;
}

public static Point3f[] GetNGonCenters(this Mesh mesh)
{
    Point3f[] centers = new Point3f[mesh.Ngons.Count];

    for (int i = 0; i < mesh.Ngons.Count; i++)
        centers[i] = (Point3f)mesh.Ngons.GetNgonCenter(i);

    return centers;
}
5 Answers
Related