Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person
- def initialize( name, height, dna_code, wife = nil )
- @name, @height, @dna_code, @wife = name, height, dna_code, wife
- end
- def height
- @name + " is " + @height + " tall."
- end
- def married?
- !@wife.nil?
- end
- def wife
- married? ? @wife : 'none'
- end
- end
- p = Person.new( 'Jason King', '188cm', 'sdfasdfadfdfs...', 'Sinéad' )
- puts p.wife
- p2 = Person.new( 'Ruben Ascencio', 'not quite 188cm', 'sdfdfddsassdd' )
- puts p2.wife
Add Comment
Please, Sign In to add comment