[haiku] Re: C++ function vs C# method

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Thu, 26 Jul 2012 22:10:52 +0200

Ryan Leavengood wrote:
> On Thu, Jul 26, 2012 at 3:32 PM, Scott Kemp <kemps4@xxxxxxxxxxxx> wrote:
> > What's the difference between the two?
> 
> Well strictly speaking C# methods are probably dispatched differently
> than C++ methods/functions, but as far as terminology in C++ a method
> and a function are interchangeable in the context of a class. Since
> C++ is derived from C it is possible to have functions which are not
> inside a class, and those are just functions. But functions inside a
> class can be called methods of that class.

I don't speak C#, but since it's similar to Java, the same may apply: Java 
(object) methods are by default virtual, while in C++ methods are by default 
non-virtual.

> > Also many people use argument and parameter interchangeably. Are these
> > terms used interchangeably in developing Haiku?
> 
> Yes I believe they are interchangeable as well.

Yeah, I think they are commonly mixed. AFAIK the correct nomenclature would be 
"formal parameter" for what is declared in the function signature and "actual 
parameter" or "argument" for a value that is passed to a the function. But 
usually, whatever term you use, it is clear what you mean.

CU, Ingo

Other related posts: