I want to use a class in C ++ that has an integer array as follows:
class A{ private: int arr[50]; }
I will read something from a text file as follows:
sum i1 i2
This means: the sum of the arrays index1 and index2 and storing in index1.
How can I do this using getters and setters, for example:
seti2(geti1()+geti2())
or something like that (because it is not very useful, I do not want to write getter and setter for each index geti1 () geti2 () ... geti50 ())
Do you have any ideas?
By the way, my second question is that getter should not have any parameters, and setter should have only one parameter?
source share