Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

Ruby | Class & Object

# Ruby program to illustrate
# the defining of methods
 
#!/usr/bin/ruby
 
# defining class Vehicle
class GFG
 
# defining method
def geeks
 
# printing result
puts "Hello Geeks!"
 
# end of method
end
 
# end of class GFG
end
 
# creating object
obj = GFG.new
 
# calling method using object
obj.geeks
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Ruby #Class #Object
ADD COMMENT
Topic
Name
5+6 =