Link to home
Start Free TrialLog in
Avatar of stankstank
stankstank

asked on

When should I make a class static?

i have been learning how to program for some time now and one thing that still stumps me to this day is knowing when to make a method static or not.  I just don't get the point of instantiating a method if I can make it static!

None of my data access classes are static, but all of the classes that do things like convert time, etc, are static.  What is the general rule on this?  I just don't get it - any help you can give is greatly appreciated.

PS - Whether I make my time classes static or not, the same result is brought out...  No differences - I have not tried data access classes iwth a static class.

Thanks alot,

StankStank
ASKER CERTIFIED SOLUTION
Avatar of almilyo
almilyo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The big difference is that with Shared (VB) or static (C#) procedures, you do NOT create an instance of the class, in order to use the shared/static procedures within the class.

AW

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin