Skip to main content

deepDestruct

Short summary

This method is a self-destruction if the object was created dynamically. If the object is a container class, the container content is destroyed with it.

Attention: For derivations: If a derived class needs deepDestruct this method must be overwritten. otherwise it just calls Object.destruct.

Parameters

none

Code

Declaration

METHOD deepDestruct
VAR
(* __DELETE(THIS) is not allowed anymore in Tc 4026.
tmp is just a helper pointer that points to this instance *)
tmp : POINTER TO CNM_AbstractObject.Object;
END_VAR

Implementation

IF (
Tc2_System.F_CheckMemoryArea(pData := THIS, nSize := SIZEOF(THIS^))
= Tc2_System.E_TcMemoryArea.Dynamic
) THEN
tmp := THIS;
__DELETE(tmp);
END_IF