Quantcast
answersLogoWhite
notificationBell
Jobs & Education
Java Programming
The Difference Between
Abstract Algebra

What is the difference between function and method?


Top Answer
User Avatar
Wiki User
Answered 2012-05-04 19:15:23

functions have independent existence means they are defined outside of the class e.g. in c main() is a function while methods do not have independent existence they are always defined inside class e.g. main() in Java is called method.

########

I've been studying OOP lately and had this question myself, so I will share my thoughts;

I was taught that "A Function should do 1(one) thing and do it well."

In specific Regards to PHP;

The difference between a Method and a Function is that a Method is tied to a specific class.

Hope this helps.

--------------------------------------------------------------------------------------------------------

function can return value where as method can't that is the main difference between function and method

---------------------------------------------------------------------------------------------------

Actually you are describing the difference between a function and a procedure. Function returns a value, procedure does not unless you are using c#, then everything is a function.

In c# a function, to paraphrase the first answer, does and thing and does it well. A method contains functions. The most important method is the Main method. All functionality of a program must be referenced in the Main method because when you run a program, it starts at the beginning of the Main method, and stops wehn it hits end of the Main method.

345
๐Ÿ™๐Ÿฟ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Still Have Questions?

Related Questions

What is the difference between Function and Method example?

Fuction and method are same . In java we call function as a method...thres no diff between them...


What is the Difference between method and functions?

method= how something is done function= what something does


Difference between function and method?

A function how a system functions or operates for given inputs to the system. A method is a process of producing a specific result.


What is difference between function and method give you an example?

A method is a function, but it's the name given to a function in an object. int Bar(void) {;} is a function int Foo::Bar(void) {;} is a method of the class Foo


What is the difference between method and function in java?

A function is a piece of code that can be reused by calling its name while a method is a function that is associated with a class. In Java, functions are usually referred to as static methods.


Difference between function and objective function?

difference between function and objectives?


What is the difference between function and method in c sharp?

A function is a method that returns a value other than void. Methods includes functions, subroutines, constructors, destructors, and properties.


Difference between Percentage of Completion method and Completed Contract method?

Difference between Percentage of Completion method and Completed Contract method?


What is the difference between the conventional method of dimensioning and the baseline method of dimensiong?

What is the difference between the conventional method of dimensioning and the baseline method of dimension


What is the difference between simplex and dual simplex method?

what is difference between regular simplex method and dual simplex method


What are the difference between roster method and rule method?

what is the difference between roster method and rule method


What is the difference between member function and normal function?

What is the difference between malloc() and calloc()?


Example of fundamental difference between a polynomial function and an exponential function?

fundamental difference between a polynomial function and an exponential function?



What is the difference between function an methods in progaming language?

A function is a type of procedure which returns a value. A method is the name given to functions and/or subroutines in certain programming languages.


What is the difference between function and method in c language?

In object-oriented languages, a class member function is also known as a method. C does not provide native support for the object-oriented paradigm and therefore does not support methods.


What is the difference between Modified accrual and Full accrual method?

What is the difference between Modified accrual and Full accrual method?"


What is the difference between function and a relation?

what is the difference between function and relation?


What is the difference between the endpoint method and the kinetic reaction method?

Kinetic method and Endpoint method used in spectrophotometery but the slight difference betwenthem is wanted.


What is the difference between cut and past?

The difference between 'cut and paste' and what other method?


What is the difference between a function and a method?

In an Object Oriented Programming (OOP) language like Java, it is called a method. In a procedural language (like QBASIC or PHP) it is called a function. They are the same thing. Most people use them interchangeably. -DJ Craig A function returns a value and method does not return a value. A function that doesn't return a value is called (procedure / subroutine)



What is the difference between the structure of an organ and function of an organ?

the difference is ,a structure is where it is placed and the function is what it daos


What is the difference between event and method?

this is not the way to question me when i question you ..... and the major difference between event and method is that event starts with alphabet E and method starts with alphabet M ok.....


Difference between research method and search model?

the differnce between a 'reserch method' and 'search model'


Still have questions?

Trending Questions
Best foods for weight loss? Asked By Wiki User
How to lose belly fat? Asked By Wiki User
Previously Viewed
Unanswered Questions
Saan nagmula ang gitara? Asked By Wiki User
Uri ng tekstong nareysyon? Asked By Wiki User
Can you get Takis at 7 eleven? Asked By Wiki User