Page 1 of 1

How does a function and class differ?

Posted: Tue May 15, 2007 10:33 pm
by SmokyBarnable
What is the difference between a function and a class?

Posted: Tue May 15, 2007 10:36 pm
by feyd
Apples and oranges.

Classes are (supposed to be) a collection of functions, called methods, that perform a common theme, collectively.

Posted: Tue May 15, 2007 10:53 pm
by SmokyBarnable
Why can't all methods be done in one function?

Posted: Tue May 15, 2007 11:16 pm
by volka
Why should they?

Posted: Tue May 15, 2007 11:22 pm
by SmokyBarnable
Efficiency

Posted: Tue May 15, 2007 11:31 pm
by volka
vs. manageability (btw: I don't even understand what "Why can't all methods be done in one function?" would mean but I doubt it to be more efficient.)
..and many more aspects. If you want to find out more about classes, methods, patterns, ... you can start here: http://en.wikipedia.org/wiki/Object-ori ... rogramming

Posted: Tue May 15, 2007 11:41 pm
by SmokyBarnable
so classes exist as an attempt to organize complex applications?

Posted: Tue May 15, 2007 11:52 pm
by volka
yes