2nd Jul 2017, 6:57 AM
‎ ‏‏‎Anonymous Guy
4 Answers
+ 1
You need to use another public function from the main : https://code.sololearn.com/cKM0XWByEL7c/?ref=app Here, the code run like this : main() publicFunction() privateFunction() return
2nd Jul 2017, 8:19 AM
Jojo
+ 1
https://code.sololearn.com/cxu3rFutRK29/?ref=app In this code I try to change the value of 'name' from the main(). But as 'name' is a private variable of 'myClass', it will output a compile error if you run it. Private membres are only accessible by functions of the class. Public membres are accessible by every functions in the code. If you haven't understand, ask! If you want more informations, ask! If you want progress, code!
2nd Jul 2017, 7:51 AM
Jojo
+ 1
thanks so to use a private function I need to mention it in a public function first right???
2nd Jul 2017, 8:35 AM
‎ ‏‏‎Anonymous Guy
0
so how to use private function in main function and why is private function used.
2nd Jul 2017, 8:13 AM
‎ ‏‏‎Anonymous Guy