Skip to content

Instantly share code, notes, and snippets.

@markson
Created May 29, 2013 05:58
Show Gist options
  • Save markson/5668240 to your computer and use it in GitHub Desktop.
Save markson/5668240 to your computer and use it in GitHub Desktop.
class Person
attr_accessor :name, :gender, :height, :weight
def initialize(name, gender, height, weight)
@name = name
@gender = gender
@height = height
@weight = weight
end
def cry
"woooo"
end
end
class Student < Person
attr_accessor :student_id
def initialize(name, gender, height, weight, student_id)
super(name, gender, height, weight)
@student_id = student_id
end
def study
"Student #{name} with #{student_id} is studying now"
end
end
s = Student.new("Lin", "Male", 173, 75, 666777)
puts s.cry()
puts s.study
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment