InterviewSolution
Saved Bookmarks
| 1. |
Which one of the following is the right way to call a class constant, given that the class is mathFunction?(a) echo PI;(b) echo mathFunction->PI;(c) echo mathFunction::PI;(d) echo mathFunction=PI;I got this question during an online exam.My doubt stems from Basics of Object-Oriented PHP- 1 topic in section Object-Oriented PHP of PHP |
|
Answer» RIGHT answer is (C) ECHO mathFunction::PI; To elaborate: The SCOPE Resolution Operator “::” is a token that allows access to static, constant, and overridden properties or methods of a CLASS. |
|