when I have a class and I’m making an object of this class, ex:
class Sample{
...
};
int main(){ Sample object1; ...}
Is the name of the object just a address to it? When I’m sending class object name as argument to a function recursively I’m just sending the address not copying the whole object in memory?
A name is not an address but a name. It exists in your source code and at compilation, but otherwise not at all (sort of). It is a semantic construct, not a value in memory.
The rules of what happens to an object whose name you’re using in your code can be found in your C++ book. In general, copies are performed by default — to avoid copies you pass by reference, or pass a pointer to an object.