[Tutor] newbie-class differs from function?

alan.gauld@bt.com alan.gauld@bt.com
Mon Mar 10 12:31:46 2003


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2E72A.B0C2E300
Content-Type: text/plain;
	charset="ISO-8859-1"

 > ... understood the difference, in hyper-simple terms, between 
>  a class and a conventional, programmer defined function. 
 
A function is a block of executable code that may take parameters and return
a value.
 
A class is a collection of data and functions that operate on the data - all
wrapped 
up in a single bundle.
 
You can create a class which only contains functions(known as methods in OO
speak) 
and then call those methods via the class. If you do that there is no real
advantage
over conventional functions - Java does this a lot...
 
Real OOP comes when you create multiple instances of a class. Each can have
its 
own set of iinternal data values and they share a common set of methods. The

instances become like little mini processes which communicate with each
other.
 
For more information and examples look at my web tutor under the OOP
section.
Alan g. 
Author of the Learn to Program website 
http://www.freenetpages.co.uk/hp/alan.gauld/
<http://www.freenetpages.co.uk/hp/alan.gauld/>  

 
PS 
The web site was down again at the weekend but is back up again now.
Dunno what's happening with freenet just now!

------_=_NextPart_001_01C2E72A.B0C2E300
Content-Type: text/html;
	charset="ISO-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">






<META content="MSHTML 5.50.4923.2500" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2>&nbsp;&gt; ...&nbsp;</FONT></SPAN>understood the difference, in 
hyper-simple terms, between<SPAN class=608592317-10032003><FONT face=Arial 
color=#0000ff size=2>&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>&gt; 
</FONT>&nbsp;</SPAN>a class and a conventional, programmer defined 
function.<SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2>&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>A 
function is a block of executable code that may take parameters and return a 
value.</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>A 
class is a collection of data and functions that operate on the data - all 
wrapped </FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>up in 
a single bundle.</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>You 
can create a class which only contains functions(known as methods in OO speak) 
</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>and 
then call those methods via the class. If you do that there is no real 
advantage</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>over 
conventional functions - Java does this a lot...</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>Real 
OOP comes when you create multiple instances of a class. Each can have its 
</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>own 
set of iinternal data values and they share a common set of methods. The 
</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2>instances become like little mini processes which communicate with each 
other.</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>For 
more information and examples look at my web tutor under the OOP 
section.</FONT></SPAN></DIV><SPAN class=608592317-10032003>
<P><FONT face="Courier New" size=2>Alan g.</FONT> <BR><FONT face="Courier New" 
size=2>Author of the Learn to Program website</FONT> <BR><FONT 
face="Courier New" size=2><A target=_blank 
href="http://www.freenetpages.co.uk/hp/alan.gauld/">http://www.freenetpages.co.uk/hp/alan.gauld/</A></FONT> 
</P>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>PS 
</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>The 
web site was down again at the weekend but is back up again 
now.</FONT></SPAN></DIV>
<DIV><SPAN class=608592317-10032003><FONT face=Arial color=#0000ff size=2>Dunno 
what's happening with freenet just now!</FONT></SPAN></SPAN></DIV></BODY></HTML>

------_=_NextPart_001_01C2E72A.B0C2E300--