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
Static function and member variables
Moderator: General Moderators
-
srikanth03565
- Forum Newbie
- Posts: 10
- Joined: Sat Jul 16, 2011 12:13 am
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Static function and member variables
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
viewtopic.php?t=127667
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Static function and member variables
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.
(#10850)
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Static function and member variables
Object Oriented Programming StaticallyJenk wrote:OOPS?
(#10850)
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Static function and member variables
I'll drink to that
