This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class and instance?

 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just want to know if what's the difference of class methods and instance method? When to use class methods or instance methods?
thanks!

raymond
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use instance methods if the result or side-effects depend on the state or contents of the object. Use class methods if the result depends only on its arguments or on other "static" data.
 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
Use instance methods if the result or side-effects depend on the state or contents of the object. Use class methods if the result depends only on its arguments or on other "static" data.

can you elaborate further or give an examples?
raymond
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic