Class vs. instance methods
class Fish
def self.general_overview()
return("Fish are animals that live in the sea")
end
def fins(bool)
@bool = bool
end
end
Fish.general_overview
Fish.fins(25)
nemo = Fish.new
nemo.fins(4)
X nemo.general_overview
Written by Melanie Archer
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Class
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#