What is the difference between a Method and a Function?

  • Thread starter Thread starter Juan Gabriel Del Cid
  • Start date Start date
J

Juan Gabriel Del Cid

I am a little confused on the sematics here. Is a C# "Function" simply a
"Method" that returns a value?

Yes, both funtions and procedures (as they are refered to in some structured
programming books) are methods. Don't get tangled with words.

Hope that helps,
-JG
 
I am a little confused on the sematics here. Is a C# "Function" simply a
"Method" that returns a value?
 
*BillyTheKid* tippselte am *22.10.2003 20:29* MESZ:
I am a little confused on the sematics here. Is a C# "Function" simply a
"Method" that returns a value?

A function is just a part of code that executes code and can return
something. A method is, in OOP, a function that is bound to a class. As
in C# there are no stand-alone functions, every function in C# is a method.

Best regards,

Michael
 
BillyTheKid,

There really is no difference. The distinction is that in C# a method
is attached to a class. Since it is an OO language, you can't have
functions, which stand alone (outside of classes).

Hope this helps.
 
BillyTheKid said:
I am a little confused on the sematics here. Is a C# "Function" simply a
"Method" that returns a value?

Method is simply object-oriented terminology for a function or
subroutine that is scoped to a class.
 
Back
Top