Web Development

Funny Answers for Public, Private and Protected

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.

Shares:
  • Sandeep
    August 11, 2011 at 8:57 pm

    The second answer is more funny than the first one.

    Reply
  • dootzky
    August 12, 2011 at 5:23 pm

    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

    Reply
    • Gilbert N Sullivan
      Gilbert N Sullivan
      August 26, 2011 at 3:20 pm

      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.

      Reply
      • melek rebai
        melek rebai
        April 5, 2012 at 4:57 am

        u are damn right

        Reply
  • Luke
    Luke
    August 16, 2011 at 5:48 pm

    Simple questions yet answers are so wrong.

    Reply
  • Ricky
    Ricky
    September 30, 2011 at 7:28 pm

    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…….

    Reply
  • melek rebai
    melek rebai
    April 5, 2012 at 4:55 am

    OMG, the second one is so funny.
    i feel sorry for the second person, he really needs to learn oop all over again

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *