- Home /
Theory: Methods and Functions
very simple question: are methods and functions the same thing?
Answer by Bonfire-Boy · Dec 03, 2018 at 04:29 PM
In the context of Unity/C#, yes they are the same thing.
A method is a function that's a member of a class. In C#, everything's a member of a class, so all functions are methods.
In other languages (e.g. C++) it's possible to have functions that aren't class members.
hey, thanks @Bonfire-Boy! a function (theoretically and generally speaking) is a process of doing something. a method (theoretically and generally speaking) as a member of a class is then that class' particular way of doing that something. is that about right?
Hmmm, I think you're overcomplicating things. Like I said, in C# there is no distinction. In languages where there is a distinction, it is really just what I said: methods have to be class members.
I should perhaps add that there was a time when people used "$$anonymous$$ethod" to mean a function that doesn't return a value. It's possible that some people still use it that way in some contexts but it's not a usage that I personally have come across for a few decades.
well, as long as i am aware there is no distinction i am happy. thanks for your quick reply!
Your answer
