How to keep a copy of value of all public members of a class. Create an explicit copy function by accessing each member is not an option because the program can be compiled with one of many possible definitions of the same class.
example: Two such classes are
file: Try1.cpp
class top
{public: int a;
int b;}
file: try2.cpp
class top
{public: int c;
int d;}
file: main.cpp
main()
{
//save all public members of top
// do operations on 'top' which may change its member variables
// check if member variables value changed, may need to restore them
}
while building the project only one of the try1.cpp or try2.cpp file would be included