+ 1
What is the difference between a method and a function?
Tell me please
4 ответов
+ 5
Put it this way.
They are the same things, EXCEPT
method -> In a class
function -> OutSide a class
I'm sure people use both terms in things like C++, but things like C# and Java you'll likely only hear 'method'. (Since functions must be in a class with those languages).
+ 5
A function is a function in a program accessible by all classes and parts of code you call them by ThisFunction() while methods are functions declared in a class and accessible only by it, you call them by Objectname.method()
+ 4
@ Esenyi
Can't call non-static methods with
ClassName.method();😜
In that case it would be:
ObjectName.method();
0
Thanks a lot for your help,
Now I see clear
Thanks for the light