OOP Basics IV Flashcards

1
Q

<p>

| What does the \_\_toString() magic method do?</p>

A
<p>
	It allows a class to decide how it will react when it is treated like a string. For example: &#39;echo $obj&#39;.</p>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When is __call() triggered?

A

When invoking inaccessible methods in an object context.

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

When is __callStatic() triggered?

A

When invoking inaccessible methods in a static context.

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

What is a ‘shallow copy’?

A

With a shallow copy, a copy is made of each property that contains a value. However, any property that contains a reference to another object or resource remains a reference.

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

When you assign an object reference to a new variable, what is created?

A

A reference to the original object.

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

When is __set() invoked?

A

When writing data to undeclared or non-visible properties.

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

When is __get() invoked?

A

When reading data from undeclared or non-visible properties.

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

When is __isset() invoked?

A

When isset() or empty() is called on undeclared or non-visible properties.

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

When is __unset() invoked?

A

When unset() is used on undeclared or non-visible properties.

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

Does property overloading work in object context? Static context?

A

Only in object context, not in static.

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

When is __call() triggered?

A

When invoking inaccessible methods in an object context.

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

When is __callStatic() triggered?

A

When invoking inaccessible methods in a static context.

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