+ 2
What's the difference b/w methods and functions?
5 ответов
+ 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.
+ 2
practicaly there isn't any. method is a function in class.
+ 1
Hey guys! can i get more accurate difference between them ??
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.
0
Thank you Pera and Miguel Peidro Montava