- Define a class.
- Build instance methods for the class.
You're going to be adding 2 instance methods to a Dog
and Person
class.
Open this lab with learn open
and run your tests with learn
.
Open lib/dog.rb
and add a class definition for a Dog
class.
Add an instance method #bark
to your Dog
class in lib/dog.rb
that will puts "Woof!"
Add an instance method #sit
to your Dog
class in lib/dog.rb
that will puts "The Dog is sitting"
.
Open lib/person.rb
and add a class definition for a Person
class.
Add an instance method #talk
to your Person
class in lib/person.rb
that will puts "Hello World!"
Add an instance method #walk
to your Person
class in lib/person.rb
that will puts "The Person is walking"
.
When you're done, submit the lab with learn submit
.
View Instance Methods Lab Ruby on Learn.co and start learning to code for free.