1.

Which method scope prevents a method from being overridden by a subclass?(a) Abstract(b) Protected(c) Final(d) StaticI got this question in an online interview.The origin of the question is Basics of Object-Oriented PHP- 2 in chapter Object-Oriented PHP of PHP

Answer»

The correct ANSWER is (C) Final

The BEST I can EXPLAIN: When we declare a method is as final then it is not possible to override that method. Methods should not be overridden DUE to some security or any other reasons.



Discussion

No Comment Found

Related InterviewSolutions