Why only implementation file needs to be compiled ?

3.When you define a class in separate files, there is an interface file and an implementation
file. Which of these files needs to be compiled? (Both? Neither? Only one? If so, which
one?)


4.Suppose you define a class in separate files and use the class in a program. Now suppose
you change the class implementation file. Which of the following files, if any, needs to be
recompiled: the interface file, the implementation file, and/or the application file?


Can sb answer and have a little explain please :) I thought both should be compiled.
Last edited on
Could anybody answer ?
Implementation files contain code that gets compiled to binary, headers only contain declarations so that other implementation files can use symbols from other files. There is no code in headers (with some exceptions, like implicitly inlined functions in a class) that gets compiled straight to binary.
Topic archived. No new replies allowed.