OOP Basics V Flashcards

1
Q

When is the __clone() method called?

A

When the ‘clone’ keyword is used to clone an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a clone of an object?

A

A shallow copy of that object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When using the ‘==’ comparison operator, two objects are equal if…

A

…they have the same attributes and values, and are instances of the same class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When using the ‘===’ identity operator, two objects are identical only if…

A

…they refer to the same instance of the same class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

With type hinting, functions are now able to force…

A

…parameters to be objects, interfaces, arrays, or callable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you force a function parameter to be an object?

A

By specifying the name of the class in the function definition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the get_called_class() function return?

A

The name of the class that the static method is called in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The ‘self’ keyword does not follow the rules of inheritance, because it always resolves to…

A

…the class in which it was used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Late static bindings can be used to…

A

…reference the called class in a context of static inheritance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does an object variable contain?

A

An object identifier which allows object accessors to find the actual object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In order to be able to unserialize an object…

A

…the class of that object needs to be defined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Does serializing an object save its methods?

A

No.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does an object variable contain?

A

An object identifier which allows object accessors to find the actual object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In order to be able to unserialize an object…

A

…the class of that object needs to be defined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Does serializing an object save its methods?

A

No.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Conventionally, class names in PHP use what format?

A

Upper camelcase.

17
Q

Conventionally, methods and attributes in PHP use what format?

A

Lower camelcase.

18
Q

Conventionally, how are private attributes named?

A

They begin with an underscore.