方法和功能之间的区别.... [英] Difference between method and function ....

查看:101
本文介绍了方法和功能之间的区别....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
你能告诉我方法和函数的主要区别是什么吗?...
我们如何识别它们? ...
谢谢.

Hi everyone,
can you tell me what is main difference between method and function ?...
how we identify them ? ...
Thank you.

推荐答案

我已经多次看过这个讨论,我的结论是这取决于编程语言.对此有很多不同的解释,但我从未见过任何明确的答案.

在stackoverflow上查看此线程:
http://stackoverflow.com/questions/155609/方法和功能之间的区别是什么 [方法与函数之间的差异 [
I''ve seen this discussion a number of times and my conclusion is that this depends on programming language. There are a lot of different explanations for this and I''ve never sees any crystal clear answer.

See this thread on stackoverflow:
http://stackoverflow.com/questions/155609/what-is-the-difference-between-a-method-and-a-function[^]

It has been discussed on codeproject earlier:
difference between method and function[^]

My opinion: A function returns a value while a method don''t.. :)


正如我所意识到的,这两个概念是相同的.这取决于编程语言.

As I realized, the both of the concepts are same. It''s depends on the programming language.

请考虑以下代码:

int Add(int a, int b)
{
    return a + b;
}

在C#中,我们将Add称为方法.但是,在C ++中,我们称其为函数.

In C# we call Add - a method. But, in C++ we call it a function.


这篇关于方法和功能之间的区别....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆