In C++ a method named the same as a class is called a constructor (similar to Python's __init__()). Fields of the class are defined elsewhere - statically in the class declaration as C++ is a strongly typed language which does not allow to add new members to objects during the life of the object. The constructor only initializes those fields with values which is what you can see in the snippet after the colon symbol. The constructor presented is called a copy constructor - it creates an instance from another instance of the same class.
Bookmarks