codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
class Agent attr_accessor :name, :location, :clearance, :active def initialize(attributes = {}) @name = attributes[:name] @location = attributes[:location] @clearnace = attributes[:clearance] @active = attributes[:active] end def show_agent maintext = "Agent #{@name} is in #{@location}. Clearance #{@clearance}" if (self.active == "Y") "#{maintext} -- ACTIVE" else "#{maintext} -- inactive" end end end arr = [0] arr[0] = Agent.new arr[0].name = "bob"
Private
[
?
]
Run code
Submit