473,544 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between method and function !!!

Atran
319 Contributor
What is the difference between method and function !!!
May 31 '07 #1
3 6340
mwalts
38 New Member
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 Contributor
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
thiago777
89 New Member
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
6936
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 guess I'll try to narrow it down to a few specific questions, but any further input offered on the subject is greatly appreciated: 1. Are all of...
9
1861
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 */ } }; class D_of_ABase : public ABase
5
36143
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
9688
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
4208
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 faster? Is there a general rule/opinion to prefere members over functions? Thanks for any hint.
13
1795
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 and the other doesn't?
5
7701
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 string.replace() am I using a module or a function or a
12
2377
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 defined the same function and in the class "subclass2", i defined the same function with 'Overloads'. Result: i get the same output.
1
1461
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 = function(obj) { self.initialize = function() {} self.toggleLineNumbers = function() {}
2
1425
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 =document.all("Items2")
0
7614
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7384
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5916
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4922
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3420
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3414
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1844
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
671
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.