Question: How can you modify the copy of an object during a clone operation?
A
B
C
D
E
Put the logic in the object's constructor to alter the values
B
C
Implement the object's __clone() method
D
E
Note: Not available
<?php
class ClassOne {
protected $a = 10;
public function changeValue($b) {
$this->a = $b;
}
}
class ClassTwo extends ClassOne {
protected $b = 10;
public function changeValue($b) {
$this->b = 10;
parent::changeValue($this->a + $this->b);
}
public function displayValues() {
print "a: {$this->a}, b: {$this->b}\n";
}
}
$obj = new ClassTwo();
$obj->changeValue(20);
$obj->changeValue(10);
$obj->displayValues();
?>
______
keyword is used to indicate an incomplete class or method, which must be further extended and/or implemented in order to be used.______
but only a single direct ________
._______
method will be called automatically when an object is represented as a string.