Skip to main content
gamedev.net
🔒 Locked

method, procedure, sub-routine?

Started by csxpcm Mar 9, 2003 at 7:27 AM 2 replies 700+ views
Original Post
csxpcm
csxpcm
hi, just a quick question A function returns something right? like: int add(int a, int b) { int c; c=a+b; return c; } and a proceedure passes back via the parameters? and would use void at the start? but to pass back via the parameters, we would have to use references or pointers, because otherwise we create a local copy and the change isnt sent back. So what is the difference between a method, procedure, and sub-routine? are they all the same thing? Can someone just clear up my misunderstanding. thanks
Brandisco
Brandisco
Yes, I _think_ they are the same thing only in different programming languages they are called a different name


Language / Term
C / Procedure
C++,Java,OOP / Method
Visual Basic, BASIC / Sub-Routine

[edited by - Brandisco on March 9, 2003 8:50:25 AM]
civguy
civguy
I don''t know if there''s any "official" definition for these terms.

Usually function, procedure and a sub-routine mean the same, but function is used most often. Yes, even for sub-routines that return nothing.

Method is used for functions that are inside classes, at least in Java world. In C++ they''re usually just "member functions".
LilBudyWizer
LilBudyWizer
It isn''t really relevant in C++. Strictly speaking a function returning void is a procedure, not a function. You cannot use it on the right hand side of an assignment statement. A procedure has no value. It performs a task, not a mapping.
Keys to success: Ability, ambition and opportunity.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.