1.

Which keyword allows class members (methods and properties) to be used without needing to instantiate a new instance of the class?(a) protected(b) final(c) static(d) privateThe question was asked in exam.This intriguing question originated from Basics of Object-Oriented PHP- 2 in division Object-Oriented PHP of PHP

Answer»

The correct answer is (c) static

Explanation: Sometimes it is very handy to access the methods and properties in terms of a CLASS RATHER than an object. But this can be done through static keyword. Any method declared as ‘static’ can be ACCESSED WITHOUT the CREATION of an object.



Discussion

No Comment Found

Related InterviewSolutions