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: 284
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?
- 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 : ?
- 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 : ....
- final keyword.
Interviewer: Give me any scenario of using final keyword.
Me : For db connection related method
Interviewer: Other than that?
Me: ...
- 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