473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Difference between method and function !!!

Atran
319 100+
What is the difference between method and function !!!
May 31 '07 #1
3 6336
mwalts
38
What is the difference between method and function !!!
Not a whole lot.

I believe the technical difference is that a function is not in a class, whereas a method is.

You'll see method and member function used interchangeably which is fine (a function that is a member of a class, get it? Correct term when discussing C++). Function and method shouldn't be used interchangeably, but often will be.

I'd suggest you don't sweat it, they both represent blocks of code that do something and might return a value.

-mwalts
May 31 '07 #2
Atran
319 100+
Not a whole lot.

I believe the technical difference is that a function is not in a class, whereas a method is.

You'll see method and member function used interchangeably which is fine (a function that is a member of a class, get it? Correct term when discussing C++). Function and method shouldn't be used interchangeably, but often will be.

I'd suggest you don't sweat it, they both represent blocks of code that do something and might return a value.

-mwalts
Thanks for your help, it help me to build my short tutorial project.
May 31 '07 #3
In VB .net, there are two types of methods: functions and subroutines.

Subroutine Declarations:

Expand|Select|Wrap|Line Numbers
  1. Sub method-name(parameter-list)
  2.    declarations and statements
  3. End Sub
Function Declarations:

Expand|Select|Wrap|Line Numbers
  1. Function method-name(parameter-list) As return-type
  2.    declarations and statements
  3. ....
  4. return expression
  5. End Function
So again, function is a method type that you can use to return values, where sub routines does not return a value. In fact, as you can see, a function or subroutine in Vb.net are both methods.

Example of a shared function in the FCL framework:

Expand|Select|Wrap|Line Numbers
  1. dim quad as integer = math.pow(2,4)
That will make, of course, quad = 16.
Hope that helped!
Jun 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: John M. Gabriele | last post by:
I've done some C++ and Java in the past, and have recently learned a fair amount of Python. One thing I still really don't get though is the difference between class methods and instance methods. I...
9
by: jlopes | last post by:
I'm looking at the differences between these to forms and see no difference in their use. When accessed through a derived class. class ABase { public: virtual void filter(){ /* some code */ }...
5
by: BillyTheKid | last post by:
I am a little confused on the sematics here. Is a C# "Function" simply a "Method" that returns a value?
3
by: Christian | last post by:
hi, what is the difference between the Page_Load() and OnLoad() event handlers. do they originate from a different point ?
7
by: Sascha Herpers | last post by:
Hi, what is the difference between the trim function and the trim String-member? As far as I see it, both return the trimmed string and leave the original string unaltered. Is any of the two...
13
by: cashdeskmac | last post by:
I am a newbie to C# and have come across some VB .NET code in my studies. I notice that VB uses functions and subs, and was wondering what the difference was. Is it that one has a return value...
5
by: sophie_newbie | last post by:
OK this might seem like a retarded question, but what is the difference between a library and a module? If I do: import string am I importing a module or a library? And if i do...
12
by: André | last post by:
Hi, i'm learning working with classes. In class "classbase1", i defined an overridable function. In the class "subclass1", i defined the same function with 'Overrides'. In class "classbase2", i...
1
by: dennis.sprengers | last post by:
I've compared some open-source javascript editors, and found different techniques for constructing the code. Two examples: CodePress.run = function() { new CodePress(t); } CodePress =...
2
by: Montezuma's Daughter | last post by:
Hi All I wanted to know what is the difference between: 1.getting an object the first worked for me and the other didn't var Subform = document.getElementById("Items2"); var Subform...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.