|
-
Jun 10th, 2002, 06:42 PM
#1
Thread Starter
PowerPoster
Class/Instance methods and the static keyword...
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...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Jun 11th, 2002, 01:03 AM
#2
Dazed Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|