Inside of a class, you can also define properties, akin to those that we have defined outside of functions.
And, as with functions, properties are "members" of the class, with each
instance of the class having its own values for those properties.
Within a function on the class, you can just refer to the property directly.
Code outside of the class, such as main()
, uses dot notation to refer
to the property, just as it uses for member functions.
You can learn more about this in:
Tags: