Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!CSSUN.TAMU.EDU!jeffw From: jeffw@CSSUN.TAMU.EDU (Jeffrey A Waller) Newsgroups: gnu.g++.bug Subject: bug/suggestion for static member func Message-ID: <8910092232.AA14163@cssune.tamu.edu> Date: 9 Oct 89 22:32:24 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 68 I believe that I have found a compiler bug, however, it may be a difference from the AT&T compiler that was not documented in the user's guide. Just the same, though, I think that the compiler incorrectly flagged an error whatever the definition of the compiler is. The version of the compiler is 1.35.0, and is running on a sun 3/260 running operating system version 4.0.3, although I doubt that the version of the op system is the cause. I have included the source code, with the the name of the file as the subject of the mail message. The error occurs on line 28 of Stringnode.c, and is Stringnode.c:28: method `long unsigned int node::IdentifySelf() is protected However, Stringnode is declared as class Stringnode: public node so IdentifySelf sould be usable by Stringnode. This is especially true in view of the declaration of IdentifySelf(): class node { . . . protected: virtual unsigned int IdentifySelf(); . . . }; The inportant part being that IdentifySelf() is virtual. On another topic, in the user's Guide you asked for any one to write in about static member functions. Extending the idea of static data members (being the same for all instances of the class) static member function could be the same with the proviso the they can only operate on static data members. This might be a way to have static class data members with constructors, although I really don't know the reason for this limitation aside from the need to call the constructors before the main program (and hence certian values may not be initialized yet). But, the main advantage for static member functions is that since their functionality is independant on the instance of the class, they do NOT need to be passed a pointer to the intance of the class. An irksome drawback I had over the summer was interfacing old C code with C++ classes; member functions could not be called directly from a C module due to the hidden variable, and also the renaming convention. Static member functions may be a way around this, as long as they are not overloaded. -Jeff Waller P.S. If for some reason the mail address is lost: jeffw@cssun.tamu.edu P.S.S. If you can't get back at all via mail snail: Jeff Waller 1501 Harvey Rd, Apt 650 College Station, TX 77840 or Jeff Waller Department of Computer Science Texas A&M University College Station, TX 77840