Showing posts with label objects in ruby. Show all posts
Showing posts with label objects in ruby. Show all posts

Thursday, October 20, 2016

Object Creation in Ruby

Here is a very short program that I wrote using Ruby programming language to show you how to create an object. This program will not only create an object but also it will display a message of the screen.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.


Program Listing

object.rb

class Sample
   def hello
      puts "Hello Ruby!\n"
 puts "Ruby Demo Only.!\n"
   end
end

# Now using above class to create objects
demo = Sample.new
demo.hello