Define constructor for a class : initialize class « Class « Ruby
- Ruby
- Class
- initialize class
Define constructor for a class
#!/usr/bin/env ruby
class Hello
def initialize( hello )
@hello = hello
end
def hello
@hello
end
end
salute = Hello.new( "Hello, myValue!" )
puts salute.hello
Related examples in the same category