Actually, C++ does not have any instruction to display the OTcl name. But if you have observed that each OTcl object has it own address which you can see by enter command "set ns [new Simulator]". The line comes after the command is the address of object ns which.
normally,in the form of "_oxx, xx=number".
You can show the object's class name,in this example $ns, by using two alternatives. "$ns info class" or "_oxx info class" (replaces xx with the number you see after the command "set ns [new Simulator]". From this characteristic, it gives the opportunity to display OTcl name
from C++ (Compiled Hierarchy).
The C++ instruction, "this->name()", gives "_oxx" of the object that pointer "this" inside
So, running this instruction (in C++ function)
tcl.evalf("puts \"OTcl name = [%s info class]\"",this->name());
will gives the OTcl name.
"this" pointer can be used after the constructor only because it is initialized after running the constructor.