BekTek wrote:
I have some qustions about recompiling in c++..
Let me show you my example..
I've got a class which has private member..
class A{
private:
void somefunc();
};
and client using it.. in different file
int main(){
A a;
// use A in whatever ways we want :)
// but except using private function
// Actually that's not legal
}
My question is if I chang the declaration of class A, for example changing
the private function name 'somefunc' to 'anyfunc', will the client code be
recompiled?
What gets recompiled in which situation is not defined in standard C++. It
depends on the toolchain you are using. Usually, some make tool is used. It
has a Makefile, from which it gets dependancy information and rules how to
build what from what. And if some file 'a' depends on a file 'b', and you
change b, a will be recompiled. So in your case, if your class definition
of class A is in a file called a.h and your main() function is in main.cpp,
then main.cpp would be recompiled if a.h was changed, and make doesn't
really care what the change was, just _that_ it changed. But as I said,
this is not a matter of the C++ language, but rather of the toolchain you
use for building your program from the sources.