Interview Questions in OOP

Posted by Fero on Programmers See other posts from Programmers or by Fero
Published on 2011-03-08T04:47:41Z Indexed on 2011/03/08 8:18 UTC
Read the original article Hit count: 256

Filed under:
|
|

Hi all,

I faced the below interview questions in OOP under PHP language. Kindly clear my clarifications regarding this. I am very confused. As i am a beginner to OOP i got too confused. Could anyone clarify these things clearly?

  1. Difference between Abstract class and interface.

Interviewer : Let us consider abstract class contains three abstract methods such as a,b,c and interface contains three methods a,b,c. In this case these do the same functionality. Then why are going for abstract and why are we going for interface.

Me : ?

  1. static keyword.

Interviewer: We call static method without creating object by using scope resolution operator in PHP. As well as we can able to call concrete methods also. Then what is need of static keyword there?

Me : ....

  1. final keyword.

Interviewer: Give me any scenario of using final keyword.

Me : For db connection related method

Interviewer: Other than that?

Me: ...

  1. Constructor.

Interviewer: What is the use of constructor?

Me : There is no need for object to access this. It will call automatically when the class calls.

Interviewer: Other than that?

Me : ....

Thanks in advance...

© Programmers or respective owner

Related posts about php

Related posts about oop