4. Private! keep out!


#1

Hi, i need help.

ruby tells me = "Oops, try again. It looks like your Dog class doesn't have a private id method."

here is my code :
def initialize(name, breed)
@name = name
@breed = breed
public

def bark
puts "Woof!"; end

private
def id
@id_number = 12345 ; end

end
end


#2

Make sure that the code in your post is identical to what you are running in the exercise.

Have you tested your code yourself? Does it seem like you have a private id method? Or what happens instead?
What information do you think would help you solve it?


#3

@briceth,
Maybe....
http://stackoverflow.com/questions/10724221/where-to-place-private-methods-in-ruby
or
http://rubylearning.com/satishtalim/ruby_access_control.html


#4

My code is not the same that the exercise but this is normal (instructions)


#5

I dont know what to do, I just follow the instructions.


#6

ok i did it :
class Dog
def initialize(name,breed)
@name = name
@breed = breed
end

public 

def bark
    puts "Woof!"
end

private

def id
    @id_number = 12345
end

end


#7

class Dog
def initialize(name,breed)
@name=name
@breed=breed
end
public
def bark
puts "Woof!"

end
private
def id

 @id_number = 12345

end
end