next up previous
Next: When should I use Up: class and struct Previous: What are static members?

When should I use a static method or a function?

A static method has full access to the members of a class. If this isn't required, the method should be a function.
class   A
{
private:
  int   i;
public:
  static void	f(A &a)
  {
    a.i = 0;
  }
};



Alexis Angelidis (PhD) 2005-01-11