Calling a method from another method
in
Programming Questions
•
6 months ago
Hello
I have a class from this type:
- class A{
- float x;
- float y;
- A(){
- x = 10;
- y = 10;
- }
- void func1(){
- //some calculations here
- func2(); //applying func2 on the result of the calculations
- }
- void func2(){
- //this function should change in some way the variables x and y, for example:
- x +=10;
- y -=5;
- }
- }
I have tried to create an ArrayList of the A class(the arraylist contains something like 10 instances) and to iterate over them and applying the func1, but it does not seem to me that func2 is called, i.e. x and y are not changed. Am I right? If so, what is the reason and how can I solve it?
Thank you!
1