0
Calling functions with objects
Hey everyone . Can someone please help me? I'm working on a project with classes. My project is getting big so I'm trying to keep everything clean and tight. I want to be able to call a function that has another function as a parameter with an object. I can't get the syntax to work and I'm not even sure if this is possible. I have attached a test code as an example for my problem. Thank you! https://code.sololearn.com/cb6Qe92Dm3Ik/?ref=app
8 Answers
0
num1.add(num1.getNum())
Here when you are calling getNum method of object num1 it returns an integer so parameter of add method should be integer.
Hope this helpsâșïžâșïž.
0
If this helps
https://code.sololearn.com/cMUv0e2ko5Ou/?ref=app
0
thank you but I think i need to be able to keep the parameter as a function not a type
0
id show you the actual code I'm working on but it's complex with header files
0
If you can elaborate more I am not getting your problem.
was my answer helpful?
0
Also try to give different names to objects , classes , variable.
It will help to debug code easily.
Like this
https://code.sololearn.com/cMUv0e2ko5Ou/?ref=app
0
that's very useful. I'm going to try to take my code and make a smaller example of it and show you
0
I changed the code to elaborate my actual issue. please take a look if you can