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.

About the Author: Avinash

Experienced full stack freelance web developer with a track record of producing excellent results for 11+ years. Excellent communication and collaboration skills, managing with a team of 20+ people. I’m motivated to make a positive impact on your revenue through the customer web portal development project.

7 Comments

  1. Sandeep August 11, 2011 at 8:57 pm - Reply

    The second answer is more funny than the first one.

  2. dootzky August 12, 2011 at 5:23 pm - Reply

    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

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

      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.

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

        u are damn right

  3. Luke August 16, 2011 at 5:48 pm - Reply

    Simple questions yet answers are so wrong.

  4. Ricky September 30, 2011 at 7:28 pm - Reply

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

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

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

Leave A Comment

FREE QUOTE

Do you need help with services? Request a free quote to get in touch.