Ruby/Class/new
Материал из Wiki.crossplatform.ru
Creating Objects by Passing Parameters to the New Method
class Customer @@no_of_customers=0 def initialize(id, name, addr) @cust_id=id @cust_name=name @cust_addr=addr end end cust1=Customer.new("0001", "V", "22, road, Atlanta") cust2=Customer.new("0002", "E", "10, road, Texas")
Creating Objects the Simple Way
class Customer @@no_of_customers=0 end cust1 = Customer.new cust2 = Customer.new