+ 3
Is a method the same as a function?
5 Answers
+ 10
Well a method is a function that is defined inside a class and associated with that class. So there is a slight difference.
In Object Oriented Programming, if I define a class, all "functions" in that class will be called methods.
For more answers (though it is about Java it pretty much applies to other languages too):
https://www.quora.com/What-is-the-difference-between-function-and-method-in-java
+ 1
Yep.
0
yes
0
I think the only different between function and method is that it can be called anywhere in the program outside the def part of that particular function but the latter could only be invoked only with the help of objects.
Like x.f() where f() is a method and x is an object(variable of some datatype int,str,list etc).
0
method is not same as function it differs in every language