This cannot be objectively answered without knowing the language.
Here are explanations for two languages which cover many of the generally important points.
Typically, some code will be duplicated while other code will not. Inline functions will of course be duplicated, and this includes any code in the class declaration which is implicitly inline. Code that is defined separately will not be duplicated.
Template classes (e.g. STL containers) are normally duplicated since they normally have the declaration and definition combined (see previous point).
Linkers can perform their own optimizations to combine code like this, although in practice I do not believe this is common.
Without a JVM or CLR to monkey around with memory at run time, whatever is compiled is highly likely to be what is loaded in memory at run time.
Byte code will not be duplicated (i.e. in
.class files). Due to the nature of class files being able to be compiled and manipulated separately, there will be no duplication or optimization across classes. However, the JIT compiler is free to inline code at runtime, which would duplicate it in memory.
Sources: Java HotSpot VM Options - JRockit (there are quite a few references but very little official Oracle documentation on this topic)