Topic: static functions


Author: jk@cs.man.ac.uk (John Kewley ICL)
Date: 22 Jan 91 14:56:58 GMT
Raw View
I have had problems trying to write a class with members who have static extent.

They are only accessed in their definition file and nowhere else.

There seems to be no way to declare a member function static, as opposed to
a static member function. Would it not be preferable to declare static member
functions using a postfixed static rather than a prefixed one in the style of
the 2 meanings of the const keyword when applied to functions.

e.g.
 static int get_static_assoc_no() const
 {
  return(static_assoc_no);
 }

would become:

 int get_static_assoc_no() const static
 {
  return(static_assoc_no);
 }

and a member which was only accessed within the current file, could be
declared:

 static local_class::local_class(/* .. */)
 {
  /*
   .
   .
  */
 }

Please don't flame me too hard, I currently have to use inline to get this
functionality!
--
        J.K.

John M. Kewley, ICL, Wenlock Way, West Gorton, Manchester. M12 5DR
Tel:   (+44) 61 223 1301 X2138  Email: jk@cs.man.ac.uk / jk@nw.stl.stc.co.uk