Explanation please: a.holder = self


#1

Hi guys,

I am having trouble making sense of the use of self in this case.

I do understand what it does, practically, but could someone please explain what this line exactly means and does, in a literal way?

Thanks a lot in advance!

NC


#2

Literally, that statement assigns self to holder.

Judging by the chapter’s title it might be meant to create some kind of a retain cycle, depending on the attribute (weak or string) of the holder property.


#3

a is the asset being added.
asset has holder pointer that points to owner (employee).
self is the employee.

a.holder (asset’s holder pointer) = self (employee)