How do you call a method from another class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you call a method from another class

Im need help, my method would return text that also calls more text

2nd Apr 2020, 2:39 AM
Jbuges
Jbuges - avatar
3 Answers
+ 2
Classname.methodname()
2nd Apr 2020, 2:59 AM
Gordon
Gordon - avatar
+ 1
That means gameStart() is not a static function and cannot be called directly. You need to either make an instance or make it static.
2nd Apr 2020, 9:19 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
When i do that i get an error that says "An object reference is required for the non-static field,method, or property 'game.gameStart()'
2nd Apr 2020, 5:17 AM
Jbuges
Jbuges - avatar