Differnece between method and function
Tell me the clear difference between method and function. I am bit confused
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Guest UserPosted Sep 21, 2016, 11:14 AM
function are block of statement which return some value
public class Class1
{
String GetCarName()
{
}
}
here string is the return type
ex - Class1 cls = new Class1();
String str = cls.GetCarName();
Methods resides inside the class
Methods are a block of statements
They can be called as ClassName.MethodName
public class class1
{
void method1()
{
}
ex- Class1 cls = new Class1();
cls.method1();
}
http://www.codeproject.com/Questions/198819/difference-between-method-and-functionRATNESH PANDEYPosted Sep 22, 2016, 2:35 AM
Bikesh SrivastavaPosted Sep 22, 2016, 2:27 AM
Rajeesh MenothPosted Sep 22, 2016, 12:40 AM
Apurba RanjanPosted Sep 22, 2016, 12:35 AM
Delpin Susai RajPosted Sep 21, 2016, 11:31 AM
Tapan PatelPosted Sep 21, 2016, 10:36 AM
Midhun TpPosted Sep 21, 2016, 10:34 AM
Now after seeing this question only i actually thought of this. Is there any difference between them? As of now i though both were same with two names as far as c# is concerned. Bt after some googling i found that most people had this doubt and many thinks it's same like me.
Some points i found out after googling is that a function can be called with just its name. But a method can be called using an object. That is methods are contained in a class, where as functions resides in pages which can be called directly without any objects.
So basically methods are functions inside class.
Hope someone will have better explanation for this.
Tejas TrivediPosted Sep 21, 2016, 10:33 AM