Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Â
Difference between functions and methods
1. Difference between Functions and Methods
S.No Functions Methods
1 Functions do not have any Methods are called by reference
reference variables variables
2 All data that is passed to a It is implicitly passed the object for
function is explicitly passed which it was called
3 It does not have access controlling It has access controlling i.e.,Method
i.e.,Function(other than static should declare and define in the class
functions) declares and defines only
anywhere in the code
4 Function applies to both object Method is only applicable to object
oriented and non-object oriented oriented programming language like
language(procedural language.eg. C++, C#, Java etc
C, Scripting language eg;
JavaScript etc)
Summary:
A function is just a part of code that executes code and can return something.
A method is, in OOP, a function that is bound to a class. As in C# there are no stand-alone
functions, every function in C# is a method
And, further updates on difference between questions and answers, please visit my blog @
http://onlydifferencefaqs.blogspot.in/