Vidyalelo
PHP · Q68

Object Oriented Concept

Programming · PHP · question 68

Q68

Which one of the following is the right way to clone an object?

A.
_clone(targetObject);
B.
destinationObject = clone targetObject;
Answer
C.
destinationObject = _clone(targetObject);
D.
destinationObject = clone(targetObject);

Answer: Option B

Solution

Answer: Option B
Solution:
You can clone an object by prefacing it with the clone keyword.