Q:

Do objects of one class share code

If there is a class A and I instantiate three objects x,y,z of A, and there is a function foo() in A, then will three copies of machine code exist for f (one for each object)?
What is the purpose of class methods? When all objects have shared code why use class methods anyway? Is it just an abstraction to an HLL programmer?

A:

No, there won't. There will be only one copy of the code. Each class instance will however have its own copies of the class's member variables.

