Using same value for different integers through a class and a structure

Example:

Taking this little integer defintion:

CharId = handler->extractKeyFromLink((char*)code, “Hcreature_entry”);
if (!CharId)
return false;
id = atoi(CharId);

Which is defined inside a gossip hello hook in the class.

And reusing it inside a structure to take the value and hook it inside a summoncreature method.

Again, taking value of id who is located in the class, and reusing it inside the structure.

Notificiations:

Tried to build a class object and declaring it inside the structure: gave me a server crash.

Thanks