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

15th Jul 2018, 3:57 PM
bklevans
bklevans - avatar
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â˜șâ˜ș.
15th Jul 2018, 5:57 PM
Meet Mehta
Meet Mehta - avatar
15th Jul 2018, 4:43 PM
Meet Mehta
Meet Mehta - avatar
0
thank you but I think i need to be able to keep the parameter as a function not a type
15th Jul 2018, 5:27 PM
bklevans
bklevans - avatar
0
id show you the actual code I'm working on but it's complex with header files
15th Jul 2018, 5:28 PM
bklevans
bklevans - avatar
0
If you can elaborate more I am not getting your problem. was my answer helpful?
15th Jul 2018, 5:48 PM
Meet Mehta
Meet Mehta - avatar
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
15th Jul 2018, 5:53 PM
Meet Mehta
Meet Mehta - avatar
0
that's very useful. I'm going to try to take my code and make a smaller example of it and show you
15th Jul 2018, 5:58 PM
bklevans
bklevans - avatar
0
I changed the code to elaborate my actual issue. please take a look if you can
15th Jul 2018, 7:47 PM
bklevans
bklevans - avatar