+ 2

What's the difference b/w methods and functions?

2nd Apr 2016, 9:21 AM
Venu Gopal Pulivarthi
Venu Gopal Pulivarthi - avatar
5 Réponses
+ 3
technically, a method is only able to do things to an object of the class it was defined in, while a function can technically use anything as an argument. This might seem a step back, as it is limitating what you can do, but it usually helps find errors in the code by providing a more solid structure.
28th Apr 2016, 11:04 AM
Miguel Peidro Montava
Miguel Peidro Montava - avatar
+ 2
practicaly there isn't any. method is a function in class.
13th Apr 2016, 11:03 AM
Pera
Pera - avatar
+ 1
Hey guys! can i get more accurate difference between them ??
16th Jun 2016, 12:54 AM
Mazin Muhamed
Mazin Muhamed - avatar
0
functions are part of a code and can be called (used) by typing its name and they are independant. that means you don't need any specific object or something else in order to call (use) them. just type function's name, forward some data if necessary and there you are. on the other hand, methods are part of the specific class and can be called via object of the same class. methods do some data processing which has its use for object "manipulation". methods may have arguments, too. both may have return value if needed. at last, functions and methods are the same but for different purposes. i hope i helped you understand basic differences and similarities. if someone has better explanation feel free to post it. i'd be grateful.
22nd May 2017, 7:14 PM
Pera
Pera - avatar
0
Thank you Pera and Miguel Peidro Montava
7th Jun 2017, 12:20 PM
Venu Gopal Pulivarthi
Venu Gopal Pulivarthi - avatar