Page 1 of 1

Static function and member variables

Posted: Sun Aug 07, 2011 12:24 pm
by srikanth03565
Hi
Can any one explain Advantages and disadvantages of static functions and its member variables.(Any language with respect to OOPS)
I have studied this on lot of sites but no one explained exact reasoning.

Why they are fast and how they are actually executed

Thanks
Srikanth Reddy

Re: Static function and member variables

Posted: Sun Aug 07, 2011 4:57 pm
by Jonah Bron
There aren't really "advantages and disadvantages", because they're not really comparable. They have different purposes. Sometimes you need to associate a method/property with an instance (i.e. an instance method/property), and sometimes you need to associate it with the class itself (i.e. a static method/property). I asked a question very similar to this a while back, and got some great answers.

viewtopic.php?t=127667

Re: Static function and member variables

Posted: Sun Aug 07, 2011 8:25 pm
by Christopher
The problem with static functions and their member variables are the same problems with globals and functions in general. So read up on the disadvantages of globals and procedural programming. The advantages is that they are quick and easy.

Re: Static function and member variables

Posted: Thu Aug 11, 2011 9:10 am
by Jenk
OOPS?

Re: Static function and member variables

Posted: Thu Aug 11, 2011 4:09 pm
by Christopher
Jenk wrote:OOPS?
Object Oriented Programming Statically :drunk:

Re: Static function and member variables

Posted: Thu Aug 11, 2011 4:31 pm
by Jonah Bron
I'll drink to that :D :drunk: