As the members were declared as public
, we can assign values and access them outside of the class definition. To access the member we use the .
operator after the class instance name.
We can also declare members as private
or protected
and they cannot be accessed this way.