<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.compsci.ca/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.compsci.ca/index.php?action=history&amp;feed=atom&amp;title=Turing_Classes_Part_I</id>
		<title>Turing Classes Part I - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.compsci.ca/index.php?action=history&amp;feed=atom&amp;title=Turing_Classes_Part_I"/>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Turing_Classes_Part_I&amp;action=history"/>
		<updated>2026-04-15T17:40:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://wiki.compsci.ca/index.php?title=Turing_Classes_Part_I&amp;diff=3544&amp;oldid=prev</id>
		<title>Wtd: Turing Class Part I moved to Turing Classes Part I</title>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Turing_Classes_Part_I&amp;diff=3544&amp;oldid=prev"/>
				<updated>2008-10-13T00:14:34Z</updated>
		
		<summary type="html">&lt;p&gt;Turing Class Part I moved to Turing Classes Part I&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 00:14, 13 October 2008&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Wtd</name></author>	</entry>

	<entry>
		<id>http://wiki.compsci.ca/index.php?title=Turing_Classes_Part_I&amp;diff=3543&amp;oldid=prev</id>
		<title>Wtd at 00:14, 13 October 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Turing_Classes_Part_I&amp;diff=3543&amp;oldid=prev"/>
				<updated>2008-10-13T00:14:10Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;At the end of this tutorial, you will find an attached .zip file.  This file contains pretty much all the code we are using in this tutorial, as well as the image for the cover of our book.  It also contains an example Button and Textfield class.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
There are many things you'll need to know to make it through this tutorial (the three parts of it).  Of particular importance, you will need to know about [http://www.compsci.ca/v2/viewtopic.php?t=4303 Modules]; a knowledge of them will make this tutorial seem very basic and straightforward.  A knowledge of '''unit'''s is needed for Part III.&lt;br /&gt;
&lt;br /&gt;
== An Introduction ==&lt;br /&gt;
&lt;br /&gt;
Have you ever heard the term, &amp;quot;Object Oriented Programming (OOP)&amp;quot;, before?  Perhaps from OOT: Object Oriented Turing. Object Oriented Programming means that one of the essential aspects of programming in an object oriented language is... objects!  You will see objects everywhere.  In a true object oriented (OO) language, such as Ruby, ''everything'' is an object; even fixed numbers, such as 42, are objects.  But what is an object?&lt;br /&gt;
&lt;br /&gt;
== What are Objects? ==&lt;br /&gt;
&lt;br /&gt;
In our daily lives, an object is something tangible, such as a book.  Objects have various properties, such as a title, author, cover, pages, writing, information, page numbers, etc.  We interact with objects.  In our book example, we interact with the book by reading it.  So, now we ask the question, &amp;quot;What are objects in programming?&amp;quot;  In programming, objects can be defined as ''that which contain data and methods with which to interact with the outside world''.  If we were to make a book object, we would need a variable to store the title, the author, the text, and the cover image, and we would need a procedure to output the text, page by page.&lt;br /&gt;
&lt;br /&gt;
:''&amp;quot;An object is a combination of data, and operations on that data. By &amp;quot;encapsulating&amp;quot; data within an object, and hiding it from the outside world, we can control the ways in which that data can be changed. Instead of the direct ability to manipulate that data, we provide only certain abilities, via methods.&amp;quot;'' &lt;br /&gt;
::[[Introduction To Java|wtd, in An Introduction to Java]]&lt;br /&gt;
&lt;br /&gt;
Let's restate the above quotation because it is important.  An object contains data and operations on that data.  In other words, it contains variables and procedures/functions that work with those variables.  Generally, the outside world sees the object and some of its procedures/functions, while other procedures/functions remain hidden, along with the variables.  To understand why, let's examine a real-life object: the book.  We interact with the book by reading it, but we cannot change what is written in the book.  If we had a book object in Turing (this is actually more of an e-book), it would have a procedure to draw the cover, then output the text to the screen.  We can then read the text off the screen, much like we read a real book.  But once again we cannot change the text.  The text of the e-book object is hidden within--it is &amp;quot;encapsulated&amp;quot;.  However, change is good, and objects generally offer some way to modify their data.  We do that by calling certain special procedures/functions that are public to the outside world.  Say we want to translate our book to French.  The text of the book is hidden to us, but perhaps the object contains a public procedure that is viewable to the outside world, one that will translate the text of the book to French.  By calling that procedure, we are translating the book into french by modifying the text of the object, the text that is hidden.  We do not look at the text variable and manually translate its value to be in French.  Rather, we call a procedure that carefully and acceptably translates the text into French.&lt;br /&gt;
&lt;br /&gt;
== What are Classes? ==&lt;br /&gt;
&lt;br /&gt;
A '''class''' is a ''template for an object''.  It defines how we create objects.  A class contains the template for creating a certain type of object.  Let's look at a book class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Book&lt;br /&gt;
    export initialize, draw_cover&lt;br /&gt;
&lt;br /&gt;
    var author : string&lt;br /&gt;
    var title : string&lt;br /&gt;
    % If this were a real book, we would use a file to store the text,&lt;br /&gt;
    % since Turing's strings can only hold 255 characters.&lt;br /&gt;
    var text : string&lt;br /&gt;
    var cover_image : int&lt;br /&gt;
&lt;br /&gt;
    % All our books are going to use the same font set,&lt;br /&gt;
    % so we make them constant.&lt;br /&gt;
    const title_font := Font.New (&amp;quot;Impact:18&amp;quot;)&lt;br /&gt;
    const title_colour := grey&lt;br /&gt;
    const author_font := Font.New (&amp;quot;Tahoma:14&amp;quot;)&lt;br /&gt;
    const author_colour := green&lt;br /&gt;
    const text_font := Font.New (&amp;quot;Times New Roman:11&amp;quot;)&lt;br /&gt;
    const text_colour := black&lt;br /&gt;
&lt;br /&gt;
    proc initialize (author_, title_, text_ : string, cover_image_ : int)&lt;br /&gt;
        author := author_&lt;br /&gt;
        title := title_&lt;br /&gt;
        text := text_&lt;br /&gt;
        cover_image := cover_image_&lt;br /&gt;
    end initialize&lt;br /&gt;
&lt;br /&gt;
    proc draw_cover (x, y : int)&lt;br /&gt;
        Pic.Draw (cover_image, x, y, picCopy)&lt;br /&gt;
        Font.Draw (title,&lt;br /&gt;
            round (x + Pic.Width (cover_image) / 2 - Font.Width (title, title_font) / 2),&lt;br /&gt;
            round (y + Pic.Height (cover_image) / 1.5), title_font, title_colour)&lt;br /&gt;
        Font.Draw (&amp;quot;By: &amp;quot; + author,&lt;br /&gt;
            round (x + Pic.Width (cover_image) / 2 - Font.Width (author, author_font) / 2),&lt;br /&gt;
            round (y + Pic.Height (cover_image) / 3), author_font, author_colour) &lt;br /&gt;
    end draw_cover&lt;br /&gt;
&lt;br /&gt;
end Book&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examine the initialize procedure.  See how I put an underscore (_) after each parameter?  That is entirely &amp;lt;u&amp;gt;not&amp;lt;/u&amp;gt; necessary: your parameters could be ''(param1, param2, param3, param4)'', and it would still work fine.  I added the underscore because I wanted to use the same variable names, ''author, title, text,'' and ''cover_image''.&lt;br /&gt;
&lt;br /&gt;
Don't worry too much about the draw_cover procedure.  The big Font.Draw calls are mostly just centering the text.  The important thing to see here is that this class is a template to create many different books.  We've examined what a book is, and concluded that all books have an author, a title, text, and a cover_image, and that these things can vary.  We decided that all our books (we are a publishing company) will have the same font and colour scheme, so we made that data constant, immutable.  We made a procedure to draw the cover of the book, and we made an initialize procedure, to set all the variable data.&lt;br /&gt;
&lt;br /&gt;
Note that this class is far from complete.  We should also add procedures to draw the text, to handle the spine of the book, the cover of the book, page numbers, table of contents, etc.&lt;br /&gt;
&lt;br /&gt;
Notice the '''export''' line, near the top.  Let's look closer at what it does.&lt;br /&gt;
&lt;br /&gt;
== Scope--Export ==&lt;br /&gt;
&lt;br /&gt;
We export our two procedures, making them callable by our soon-to-be book objects.  A nicer way to look at this (and how most other languages look at it) is that ''initialize'' and ''draw_cover'' are &amp;lt;u&amp;gt;public&amp;lt;/u&amp;gt; methods.  Anything that is not '''export'''ed is invisible to the outside world.  We can also '''export''' variables.  We will come back to this when we learn how to call methods on objects.  &lt;br /&gt;
&lt;br /&gt;
== Scope--Import ==&lt;br /&gt;
&lt;br /&gt;
We can '''import''' things into our classes.  By default, things outside the class are not accessible within the class.  For example, the following creates a warning:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var outer_variable := &amp;quot;I'm on the edge&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class TestClass&lt;br /&gt;
    var inner_variable := outer_variable&lt;br /&gt;
end TestClass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To avoid the warning, we need to '''import''' ''outer_variable''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var outer_variable := &amp;quot;I'm on the edge&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class TestClass&lt;br /&gt;
    import outer_variable&lt;br /&gt;
    var inner_variable := outer_variable&lt;br /&gt;
end TestClass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates no warning.  You may need to import specific '''module'''s, such as the '''Input''' module, if you wish to use '''Input.KeyDown''' within your class.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class TestClass&lt;br /&gt;
    %import Input&lt;br /&gt;
    var keys : array char of boolean&lt;br /&gt;
    Input.KeyDown (keys)&lt;br /&gt;
end TestClass&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a warning, but if you uncomment the &amp;quot;''import Input''&amp;quot;, the warning is avoided.&lt;br /&gt;
&lt;br /&gt;
Together, you and I, we wrote a book, and we want to use our Book class to create our book object.&lt;br /&gt;
&lt;br /&gt;
== How Do We Create Objects? ==&lt;br /&gt;
&lt;br /&gt;
To create an object in Turing, we have to use '''pointers'''.  We have a tutorial on pointers, but it is rather complicated, and much of it is not all that necessary for our discussion of classes.  To that end, I will briefly describe how we use pointers here.&lt;br /&gt;
&lt;br /&gt;
There are two steps to creating an object.  First, we must create a pointer that points to the class.  The pointer variable is essentially how we access our book object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var jack_and_jill : pointer to Book&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we need to create a new ''instance of the Book class''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
new Book, jack_and_jill&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We use '''new''' to &amp;lt;u&amp;gt;create a new instance of the Book class, linked to our jack_and_jill pointer&amp;lt;/u&amp;gt;.  You might be thinking that this seems repetitive: why have ''jack_and_jill'' point to ''Book'', and then create a new instance of ''Book'' linked to ''jack_and_jill''?  Can't we just do one or the other, and Turing figure it out automatically?  The answer is &amp;quot;No&amp;quot;, for reasons that will become apparent in Part III of this tutorial.&lt;br /&gt;
&lt;br /&gt;
Next, we need to learn how to call our procedures for our ''jack_and_jill'' object.&lt;br /&gt;
&lt;br /&gt;
== How Do We Call Procedures/Functions? ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to call methods (procedures/functions) from an object.  For our current purposes, the two approaches are identical in every way except for their appearance: one is shorthand for the other.  First, let's look at the original one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ClassName (pointer_name).method_name (arguments)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the use of class/method/variable naming is my own choice, and you're free to choose your own.&lt;br /&gt;
&lt;br /&gt;
In the context of our Book class, it could look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Book (jack_and_jill).initialize (&amp;quot;Cervantes et al.&amp;quot;, &amp;quot;Jack and Jill&amp;quot;, &amp;quot;Jack and Jill went up a hill to fetch a pail of water.&amp;quot;, Pic.FileNew (&amp;quot;Jack and Jill.jpg&amp;quot;))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice a neat thing I've done here.  I've passed a function, ''Pic.FileNew'' as a parameter to the initialize procedure.  Pretty cool, and yet it makes perfect sense.  ''Pic.FileNew'' is a function that returns an integer, and that's exactly what the ''cover_image_'' parameter is asking for.&lt;br /&gt;
&lt;br /&gt;
Now, let's see what the shorthand approach looks like.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pointer_name -&amp;gt; method_name (arguments)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
jack_and_jill -&amp;gt; initialize (&amp;quot;Cervantes et al.&amp;quot;, &amp;quot;Jack and Jill&amp;quot;, &amp;quot;Jack and Jill went up a hill to fetch a pail of water.&amp;quot;, Pic.FileNew (&amp;quot;Jack and Jill.jpg&amp;quot;))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It seems that the shorthand approach is nicer, but I urge you to avoid it because it makes an assumption about the class that the method belongs to.  In Part III, when we start building a network of classes, we will need to specify which class we are calling our method from, and that specific class can be different than the class Turing automatically assumes we are calling from.  In my example classes at the end of this tutorial, sadly, I did not follow my own advice here, for that was before I learned about Turing's inheritance, which is the topic for Part III.&lt;br /&gt;
&lt;br /&gt;
Here is our complete code, thus far:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Book&lt;br /&gt;
    export initialize, draw_cover&lt;br /&gt;
&lt;br /&gt;
    var author : string&lt;br /&gt;
    var title : string&lt;br /&gt;
    % If this were a real book, we would use a file to store the text,&lt;br /&gt;
    % since Turing's strings can only hold 255 characters.&lt;br /&gt;
    var text : string&lt;br /&gt;
    var cover_image : int&lt;br /&gt;
&lt;br /&gt;
    % All our books are going to use the same font set,&lt;br /&gt;
    % so we make them constant.&lt;br /&gt;
    const title_font := Font.New (&amp;quot;Impact:18&amp;quot;)&lt;br /&gt;
    const title_colour := grey&lt;br /&gt;
    const author_font := Font.New (&amp;quot;Tahoma:14&amp;quot;)&lt;br /&gt;
    const author_colour := green&lt;br /&gt;
    const text_font := Font.New (&amp;quot;Times New Roman:11&amp;quot;)&lt;br /&gt;
    const text_colour := black&lt;br /&gt;
&lt;br /&gt;
    proc initialize (author_, title_, text_ : string, cover_image_ : int)&lt;br /&gt;
        author := author_&lt;br /&gt;
        title := title_&lt;br /&gt;
        text := text_&lt;br /&gt;
        cover_image := cover_image_&lt;br /&gt;
    end initialize&lt;br /&gt;
&lt;br /&gt;
    proc draw_cover (x, y : int)&lt;br /&gt;
        Pic.Draw (cover_image, x, y, picCopy)&lt;br /&gt;
        Font.Draw (title,&lt;br /&gt;
            round (x + Pic.Width (cover_image) / 2 - Font.Width (title, title_font) / 2),&lt;br /&gt;
            round (y + Pic.Height (cover_image) / 1.5), title_font, title_colour)&lt;br /&gt;
        Font.Draw (&amp;quot;By: &amp;quot; + author,&lt;br /&gt;
            round (x + Pic.Width (cover_image) / 2 - Font.Width (author, author_font) / 2),&lt;br /&gt;
            round (y + Pic.Height (cover_image) / 3), author_font, author_colour)&lt;br /&gt;
    end draw_cover&lt;br /&gt;
&lt;br /&gt;
end Book&lt;br /&gt;
&lt;br /&gt;
var jack_and_jill : pointer to Book&lt;br /&gt;
new Book, jack_and_jill&lt;br /&gt;
&lt;br /&gt;
Book (jack_and_jill).initialize (&amp;quot;Cervantes et al.&amp;quot;, &amp;quot;Jack and Jill&amp;quot;, &amp;quot;Jack and Jill went up a hill to fetch a pail of water.&amp;quot;, Pic.FileNew (&amp;quot;Jack and Jill.jpg&amp;quot;))&lt;br /&gt;
Book (jack_and_jill).draw_cover (50, 50)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can find the image I've used as the ''cover_image'' as an attachment at the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
Now let's take a closer look at how this is all working.&lt;br /&gt;
&lt;br /&gt;
== A Closer Examination ==&lt;br /&gt;
&lt;br /&gt;
When we create the new instance of the class linked to our pointer (by using '''new'''), the object is initialized.  All the code excluding our methods is executed.  In the case of our Book class, the code that makes our variables and constants is executed.  This makes sense, but let's take a closer look.  &lt;br /&gt;
&lt;br /&gt;
The code that creates the variables and constants and defines our methods is written in our class, but the variables, constants, and methods (henceforth known as ''data'') belong to the object, ''jack_and_jill''.  What would happen if the data belonged to the class?  We only have one class, so we would only have one set of data.  We can write many books though, and use the same template (class) for our other books.  Each book needs its own title, its own author, etc.  Thus, the data must belong to the object, and there must be a set of data for each object we create.&lt;br /&gt;
&lt;br /&gt;
== Returning to Export ==&lt;br /&gt;
&lt;br /&gt;
Earlier I mentioned we could export variables as well as procedures/functions.  Let's examine that now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class TestClass&lt;br /&gt;
    export test_var&lt;br /&gt;
    &lt;br /&gt;
    var test_var := 5&lt;br /&gt;
end TestClass&lt;br /&gt;
&lt;br /&gt;
var p : pointer to TestClass&lt;br /&gt;
new TestClass, p&lt;br /&gt;
&lt;br /&gt;
put TestClass (p).test_var&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This outputs 5, the value of test_var.  We can also change the value of our variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class TestClass&lt;br /&gt;
    export var test_var&lt;br /&gt;
    &lt;br /&gt;
    var test_var := 5&lt;br /&gt;
end TestClass&lt;br /&gt;
&lt;br /&gt;
var p : pointer to TestClass&lt;br /&gt;
new TestClass, p&lt;br /&gt;
&lt;br /&gt;
put TestClass (p).test_var&lt;br /&gt;
TestClass (p).test_var := 42&lt;br /&gt;
put TestClass (p).test_var&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, it is important to note that giving full access to the data of our object is generally frowned upon.  As discussed earlier, objects allow the outside world to manipulate their data by calling certain methods.  To that end, the following class essentially gives the outside world full access to its data (read &amp;amp; write access), but in a more conventional style.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class TestClass&lt;br /&gt;
    export set_test_var_to, value_of_test_var&lt;br /&gt;
    &lt;br /&gt;
    var test_var := 5&lt;br /&gt;
    &lt;br /&gt;
    proc set_test_var_to (value : int)&lt;br /&gt;
        test_var := value&lt;br /&gt;
    end set_test_var_to&lt;br /&gt;
    &lt;br /&gt;
    fcn value_of_test_var : int&lt;br /&gt;
        result test_var&lt;br /&gt;
    end value_of_test_var&lt;br /&gt;
    &lt;br /&gt;
end TestClass&lt;br /&gt;
&lt;br /&gt;
var p : pointer to TestClass&lt;br /&gt;
new TestClass, p&lt;br /&gt;
&lt;br /&gt;
put TestClass (p).value_of_test_var&lt;br /&gt;
TestClass (p).set_test_var_to (42)&lt;br /&gt;
put TestClass (p).value_of_test_var&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Q&amp;amp;A ==&lt;br /&gt;
&lt;br /&gt;
At this point, I feel the most practical example of classes in action is seen in GUI (Graphical User Interface).  If you look at the code for Turing's GUI, you will see a network of classes all over the place.  For now, we only need look at one class.  The simplest and most useful one is the Button class, and you can make it yourself.  &lt;br /&gt;
&lt;br /&gt;
=== Question 1 ===&lt;br /&gt;
&lt;br /&gt;
Make a Button class, similar to the buttons Turing's GUI uses.&lt;br /&gt;
&lt;br /&gt;
=== Answer 1 ===&lt;br /&gt;
&lt;br /&gt;
I've attached my Button class (see the end of this tutorial for the attachment), which I made about a year ago.  It could use some attention, if anyone is willing to clean it up (or possibly rebuild it, showing how to build a Button class in stages).&lt;br /&gt;
&lt;br /&gt;
=== Question 2 ===&lt;br /&gt;
&lt;br /&gt;
Make a TextField class, similar to the address bar of an internet browser, where you enter the URL.&lt;br /&gt;
&lt;br /&gt;
=== Answer 2 ===&lt;br /&gt;
&lt;br /&gt;
My TextField class (and examples) can be found [http://www.compsci.ca/v2/download.php?id=3269 here], in my [http://www.compsci.ca/v2/viewtopic.php?t=9329 Database with Custom GUI] thread. &lt;br /&gt;
&lt;br /&gt;
Note that, in my Button and TextField code, you will find me declaring pointers to classes like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var pointer_name : ^ClassName&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is merely shorthand to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var pointer_name : pointer to ClassName&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is identical in every way, except appearance.&lt;br /&gt;
&lt;br /&gt;
== Conclusion &amp;amp; Further Studies ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is in three parts.  This tutorial has covered the basics of classes.  Know that to really get a good understanding of classes, you &amp;lt;u&amp;gt;will&amp;lt;/u&amp;gt; need to write some of your own classes and put them to use.  I've suggested two possible classes to make, though the options are many.  When you are ready, read [http://www.compsci.ca/v2/viewtopic.php?t=10905 Part II] of this tutorial, which deals with &amp;lt;u&amp;gt;object interaction&amp;lt;/u&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Wtd</name></author>	</entry>

	</feed>