OOP Basics V Flashcards
When is the __clone() method called?
When the ‘clone’ keyword is used to clone an object.
What is a clone of an object?
A shallow copy of that object.
When using the ‘==’ comparison operator, two objects are equal if…
…they have the same attributes and values, and are instances of the same class.
When using the ‘===’ identity operator, two objects are identical only if…
…they refer to the same instance of the same class.
With type hinting, functions are now able to force…
…parameters to be objects, interfaces, arrays, or callable.
How do you force a function parameter to be an object?
By specifying the name of the class in the function definition.
What does the get_called_class() function return?
The name of the class that the static method is called in.
The ‘self’ keyword does not follow the rules of inheritance, because it always resolves to…
…the class in which it was used.
Late static bindings can be used to…
…reference the called class in a context of static inheritance.
What does an object variable contain?
An object identifier which allows object accessors to find the actual object.
In order to be able to unserialize an object…
…the class of that object needs to be defined.
Does serializing an object save its methods?
No.
What does an object variable contain?
An object identifier which allows object accessors to find the actual object.
In order to be able to unserialize an object…
…the class of that object needs to be defined.
Does serializing an object save its methods?
No.