I am using CycloneDDS c++ build.
currently, I am able to publish and subscriber primitive data types.
.idl file contains data structure
How to send an object or publish and subscribe an object in CycloneDDS?
Edited - object = both data ("state") and code ("methods")
From above comment correct answer is
DDS is intended for distributing data. Distributing objects, as "their states and method implementations", is not described in any of the OMG DDS standards and not natively implemented by any of the DDS implementations