Recompilation - classes

I was wondering Why must all the clients of a particular C++ class be re-compiled when the storage structure of that class’ data members has changed?
1
2
3
4
5
6
7
8
9
10
11
//some header
struct foo{
   //int bar;
};


//some cpp
void asdf(){
   foo zzz;
   zzz.bar = 42; //¿what do you expect this to do?
}
bar is not defined?
bar was defined, then it was no more.
So `asdf()' makes no sense, and should generate an error. ¿how could you manage that without trying to recompile it?
when the storage structure of that class’ data members has changed

... because this will imply that more or less memory will be needed to manage the class than before
http://stackoverflow.com/questions/4033487/c-when-recompilation-is-required
makes sense, that's what I meant to say when I said bar is not defined "anymore"

thanks a lot
Topic archived. No new replies allowed.