Creating Objects by Passing Parameters to the New Method

2019-06-19 20:02栏目:技术创新

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 by Passing Parameters to the New Method