Topic: Static & non-static member functions


Author: richard@aisg (Richard)
Date: Fri, 2 Apr 93 16:07:34 GMT
Raw View
Hi,

Static member function cannot not access a non-static member
variable.  Does any one know some way to go around this?

Any help would be appreciated

Richard







Author: b91926@fnclub.fnal.gov (David Sachs)
Date: 2 Apr 1993 18:58:23 GMT
Raw View
In article <1993Apr2.160734.10619@aisg.com>, richard@aisg (Richard) writes:
|> Hi,
|>
|> Static member function cannot not access a non-static member
|> variable.  Does any one know some way to go around this?
|>
|> Any help would be appreciated
|>
|> Richard
|>
|>
|>

You can access non-static member variables by using the "." or "->" operators on the object you wish to access the members of.

You MUST have an object to reference. By DEFINITION, static member functions are NOT inherently associated with any particular class object and do not have a "this" pointer.




Author: jimad@microsoft.com (Jim Adcock)
Date: 05 Apr 93 19:53:33 GMT
Raw View
In article <1993Apr2.160734.10619@aisg.com> richard@aisg writes:
|Static member function cannot not access a non-static member
|variable.  Does any one know some way to go around this?

Use a non-static member function.  A primary difference between a
non-static and a static member function is that non-static member
functions are passed sufficient information to allow them to access
non-static members, whereas static member functions are NOT
passed sufficient information to allow them to access non-static members