According to this site the static methods
static Point rectangular(float x, float y);
static Point polar(float radius, float angle);
invoke the private constructor Point (a non-static method) as reproduced below :
#include <cmath> // To get std::sin() and std::cos()
class Point {
public:
static Point rectangular(float x, float y); // Rectangular coord's
static Point polar(float radius, float angle); // Polar coordinates
// These static methods are the so-called "named constructors"
...
private:
Point(float x, float y); // Rectangular coordinates
float x_, y_;
};
inline Point::Point(float x, float y)
: x_(x), y_(y) { }
inline Point Point::rectangular(float x, float y)
{ return Point(x, y); }
inline Point Point::polar(float radius, float angle)
{ return Point(radius*std::cos(angle), radius*std::sin(angle)); }
};
Edit: I’m having difficulties accepting an answer, since I don’t know which one is correct.
A constructor is a special case, because a constructor doesn’t need an existing object to be called.
The rule you mention would be better remembered as “A static member function doesn’t have an implicit
thispointer”.