+ 1

What is the difference between a method and a function?

Tell me please

24th Jul 2017, 10:57 PM
Jacques-Mary Désir
Jacques-Mary Désir - avatar
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).
24th Jul 2017, 11:07 PM
Rrestoring faith
Rrestoring faith - avatar
+ 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()
24th Jul 2017, 11:23 PM
LordGhostX
LordGhostX - avatar
+ 4
@ Esenyi Can't call non-static methods with ClassName.method();😜 In that case it would be: ObjectName.method();
24th Jul 2017, 11:25 PM
Rrestoring faith
Rrestoring faith - avatar
0
Thanks a lot for your help, Now I see clear Thanks for the light
25th Jul 2017, 11:33 PM
Jacques-Mary Désir
Jacques-Mary Désir - avatar