Private! Keep Out!


#1

https://www.codecademy.com/en/courses/ruby-beginner-en-zfe3o/0/4?curriculum_id=5059f8619189a5000201fbcb

class Dog
def initialize(name, breed)
@name = name
@breed = breed

public

def bark
    puts "bark!"

private

def id
@id_number = 12345

end
end
end
end

Not sure what I'm doing wrong here. Can anyone help me out. The error I keep getting is "It looks like your Dog class doesn't have a private id method."


#2

Please post a link to this exercise so we can check it out. Thanks.


#3

I added the link to the exercise.


#4

Each of your methods needs an immediate end, rather than all at the bottom.

def initialize(...)

end

def bark

end

def id

end

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.