If you were following from the first post you’d have been pointed to this;
If you didn’t read it, here it is;
“Access to all Maya objects (curves, surfaces, DAG nodes, dependency graph nodes, lights, shaders, textures, etc.) is done through a handle object called an MObject. This handle provides a few simple methods to help determine the object type (see the MObject class documentation for a complete description). The MObject destructor does not delete the Maya object that it references—calling the destructor only deletes the handle object, thereby maintaining ownership.
IMPORTANT: You should never keep a pointer to an MObject between “runs” of the plug-in. Instead you may want to use an MObjectHandle since this object contains information on the validity of the MObject.”
The last part is pretty important, if you’re expecting to use the MObject right away you might get away with passing it along immediately, but if you’re expecting it to hang around for future reference;
At some stage you’re going to want to check the type of MObject you have. Is it a transform? skinCluster?
To do this you can use;