class Foo @@bar = "foobar" end # undefined method `bar' for Foo:Class (NoMethodError) puts Foo.bar
class Foo @@bar = "foobar" def self.bar @@bar end end puts Foo.bar #=> "foobar"
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.