|
|
|
|
145
|
|
145
|
|
146
|
`TypeReturned ClassName::MethodName(parameters)`
|
146
|
`TypeReturned ClassName::MethodName(parameters)`
|
147
|
|
147
|
|
148
|
-We declare public methods within the class so that objects that are instances of a class have permission to access private variables (these are the setters and getters). It's preferred to use private variables and access them through the setters and getters, instead of declaring them public since the object that is associated to these variables would have control over the changes that are made.
|
|
|
|
|
148
|
+We declare public methods within the class so that objects that are instances of a class have permission to access private variables (see below setters and getters). It's preferred to use private variables and access them through the setters and getters, instead of declaring them public since the object that is associated to these variables would have control over the changes that are made.
|
149
|
|
149
|
|
150
|
To invoke a method we write the name of the object, followed by a period and then the name of the method:
|
150
|
To invoke a method we write the name of the object, followed by a period and then the name of the method:
|
151
|
|
151
|
|