////////////// Set.h //////////
class Set {
public:
void *set_elements;
int area;
Set(int);
};
////////////// Set.cpp //////////
Set::Set(int object) {
area = object;
set_elements = &object;
}
////////////// Area.h //////////
class Area {
private:
Set *set;
call Area construct is fine, Set(5) work fine but when call add function Set class void * variable change actual value to Set object address value what is reason.
e.g
Set(5) address = 0x0022fe34
Area::add(Set obj){
}
when calling add func. value of set_elements change from &int to &Set by default
what is it problem
A problem is that in the Set constructor you assign set_elements an address of a temporary value. It could point to anything afterwards.
I don't really get what you're trying to do, so can't suggest anything.
Do put it all in [code] tags.