To get and set various variables inside structs in C++The main struct object should be a pointer.the structs have got so many member function to get and set it variables from the user.finally the structs should be protected in such a way that no two users can change the details at same time..using mutex to avoid locking .Kindly help me to frame this code as i am a newbie in coding.

Recommended Answers

All 3 Replies

Each set locks a mutex, then changes the variable, then unlocks the mutex. Make sure the struct's internal variables are private so only the set function can change them.

Thanks for the response.Can u help me write this code as i am really new to this .

Sorry, but we don't do your homework for you... :-(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.