Click to See Complete Forum and Search --> : Class/Instance methods and the static keyword...
rjlohan
Jun 10th, 2002, 06:42 PM
What do they all mean? My book here is a bit vague on the subject. I'm really interested as to what exactly the static modifier on a method name does.
I'm creating a small class-inheritance thing, and the examples in the 'inheritance' chapter don't use the static modifier, and doesn't really explain why...
:)
Dillinger4
Jun 11th, 2002, 01:03 AM
That is a very good question. I know that when a variable or "class member" is declared as static it's data remains persistent across multiple instances. There seems to be a direct relation between static methods and static members since a static method can only access a static member not an instance member since there is no object being operated on when the object is invoked. As far as i can tell the main benefit of static methods is when they are used in conjunction with static members(when accessing data that remains persistent across multiple instances) as no object instance is needed.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.