Like any other assignment, p = lp
copies the value on the right-hand side (RHS) and stores it in the variable on the left-hand side (LHS). In this specific instance, the value being copied is the class handle stored in the class variable lp
. This handle, incidentally, serves as a reference to an instance of a LinkedPacket
object.
Any class variable can hold a handle(reference) to a class object of the same class type or any of its derivatives. In this example code, we know the variable p
has a handle referencing a LinkedPacket
object. We wouldn’t know this is more complex code, and the LRM only allows references defined by the class type of the class variable storing the handle.