I am a beginner of C++ with Python background. I have some ambiguity about the process of obtaining instance attributes in Python classes and C++ classes.
As follows, I list two classes that have the same function in Python and C++ respectively.
My problem is that I am used to using self parameters to distinguish class attributes and instance attributes, and to ensure that instance attributes between different instances do not interfere with each other. But I do not know how C++ can do this without self parameters.
I hope someone can explain in detail how C++achieves “self” without self, and what happens in under the hood?
Thanks