Kontact makes extensive use of several KDE key technologies, most notably KParts and D-Bus.
The GUI integration of the components is done by plugins providing KParts versions of the applications. This only needs a thin additional layer on top of the already existing code of the stand-alone applications.
For communication between the components D-Bus is used. This has the nice characteristic that it is completely transparent to whether the application is run stand-alone or embedded as KPart into Kontact. When running inside of Kontact an efficient in-process mode of D-Bus is used.