Generally I don’t post this type of post here. As a Sr Developer, generally I have to take interviews of php developers. Its a great fun to take a interview of the people specially for me.
This is because I get some funny answers to my question. I have got lots of funny answers generally from freshres but some times from experienced persons also.
But for today I have taken two interviews and got some extra ordinary answer for the same question. Actually these answers are forcing me to write this post.
Question was:
What is the difference between Public, Private and Protected?
My intention was to check their oop concepts. But here is what I got:
Answer 1 :
Every one can access public, no one can access private and some one can access protected.
Answer 2 :
( Actually this person was very eager to answer this question )
public methods can be accessed by the guest of the website, private methods can be accessed by the logged in user and protected methods can be accessed by some special users of the website.
You can also share your experience here.
The second answer is more funny than the first one.
well, actually, this is not too funny if you think about it.. the guys gave you an honest simple interpretation.
you probably expected some high-tech very precise kind of response, but the point is that it’s semantics, if those guys know program and use classes and OOP model of thinking – they are good enough :P
I hate those stupid interview questions, and interviews in overall.. you should be able to see if somebody knows to code or not in a very few examples..
cheers,
dootzky
You can’t be serious. This is an interview question for a programming job. If you can’t give a correct answer to a *basic* question about OOP inheritance and encapsulation you’re a liability.
Actually I doubt very much – given your complaint – whether you would have answered correctly either.
u are damn right
Simple questions yet answers are so wrong.
ha ha ha.. interesting answer…
If I want to understand…,
public methods can be accessed by the guest of the website— method you can call through the program
private methods can be accessed by the logged in user— method call in class or in extended class
protected methods can be accessed by some special users of the website.– only in class
not 100% correct but quite interesting…….
OMG, the second one is so funny.
i feel sorry for the second person, he really needs to learn oop all over again