Which of the following statements is/are true about Constructors in PHP? i) PHP 4 introduced class constructors. ii) Constructors can accept

Đạt Michio

New member
Which of the following statements is/are true about Constructors in PHP?
i) PHP 4 introduced class constructors.
ii) Constructors can accept parameters.
iii) Constructors can call class methods or other functions.
iv) Class constructors can call on other constructors.
A. ii)
B. ii) and iii)
C. i), ii), iii) and iv)
D. ii), iii) and iv)
 
Answer: c
Explanation: If a class name and the function name is similar then the function is known as constructor. Constructor is automatically called when an object will be initialized. Constructors can accept parameters. Constructors can call class methods or other functions. Class constructors can call on other constructors.
 

Tìm kiếm

Back
Top