+ 3
Method and function
what the different between methods and function in c#
1 Respuesta
+ 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.