When I create a class , lets say Person which includes:
private:
Id and name.
public:
ctor, copy ctor, three member functions.
What does the compiler do everytime I create an instance of person? what happens behind the scenes?
I know that it calls the ctor first to create the object, but how does it "connect" the object with the member functions? does it create separate member functions for each object created..? I guess not. what does it do then?
It's pretty easy: When a member function is called the first invisible parameter is the pointer to the surrounding object. The name of the paramater is this. member variables are accessed (again invisibly) via the this pointer
So, all of the class's member functions are created the first time I create an instance of a class? And then when I create a second instance it uses the first's ?