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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Guest UserRank #2,002 · 726 reputationPosted Sep 21, 2016, 7:14 AM EDT
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-functionTejas TrivediRank #1,247 · 1.4K reputationPosted Sep 21, 2016, 6:33 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Sep 21, 2016, 6:34 AM EDT
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.
Tapan PatelRank #614 · 3.9K reputationPosted Sep 21, 2016, 6:36 AM EDT
Delpin Susai RajRank #53 · 29.5K reputationPosted Sep 21, 2016, 7:31 AM EDT
Apurba RanjanRank #4,352 · 349 reputationPosted Sep 21, 2016, 8:35 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Sep 21, 2016, 8:40 PM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Sep 21, 2016, 10:27 PM EDT
RATNESH PANDEY20 reputationPosted Sep 21, 2016, 10:35 PM EDT