Function vs Methods
There are given, what is the difference between Function and Method.
Function
|
Method
|
It is a piece of code that is called by name.
|
It is also a piece of code that is called by a name
|
It can be passed data to operate on (i.e. the parameters)
|
It is associated with an object.
|
It can optionally return data (the return value).
|
It is identical to a function except for two key differences:
|
All data that is passed to a function is explicitly.
|
A method is implicitly passed the object on which it was called.
|
It has no any reference variable
|
It is called by reference variable
|
Function applies both object oriented and non-object oriented language. C and JavaScript etc
|
It is only applicable to object oriented programming language like c#, C++ and java etc
|
0 $type={blogger}:
Post a Comment