Method and function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Method and function

what the different between methods and function in c#

29th Jan 2018, 4:45 AM
Eslam Akrm
Eslam Akrm - avatar
1 Answer
+ 8
Functions : Functions have independent existence means they can be defined outside of the class. Ex:- main() function in C, C++ Language Functions are defined in structured languages like Pascal,C and object based language like javaScript Functions are called independently. Functions are self describing unit of code. Methods : Methods do not have independent existence they are always defined with in class. Ex:- main() method in C# Language that is defined with in a class Methods are defined in object oriented languages like C#, Java Methods are called using instance or object. Methods are used to manipuate instance variable of a class.
29th Jan 2018, 5:16 AM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar