<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C.M. Jackson .Net &#187; Object Oriented Programming</title>
	<atom:link href="http://www.cmjackson.net/tag/object-oriented-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cmjackson.net</link>
	<description>Web Design, Programming, Tutorials</description>
	<lastBuildDate>Tue, 13 Dec 2011 17:38:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Dependency Injection</title>
		<link>http://www.cmjackson.net/2010/01/27/dependency-injection/</link>
		<comments>http://www.cmjackson.net/2010/01/27/dependency-injection/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 14:33:10 +0000</pubDate>
		<dc:creator>Chris Jackson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://www.cmjackson.net/?p=358</guid>
		<description><![CDATA[Dependency Injection is a design pattern that is used in Object Oriented Programming to create a relationship between two objects without object A depending on object B. Instead, through the use of an Interface, a place-holder for object B can be referenced in object A. Then, object B can be passed into object A where it is [...]]]></description>
			<content:encoded><![CDATA[<p>Dependency Injection is a design pattern that is used in Object Oriented Programming to create a relationship between two objects without object A depending on object B. Instead, through the use of an Interface, a place-holder for object B can be referenced in object A. Then, object B can be passed into object A where it is utilized. If there is an object C that uses the same interface as object B, it may also be passed into object A.</p>
<p><strong>A Tightly Coupled Relationship</strong><br />
Below is an example of two classes that are tightly coupled, meaning that if we want to replace object B with another class, we must change the code of object A. Object A is dependent on object B to execute.</p>
<pre class="brush: vb;">
Public Class ObjectA

  Private _obj As ObjectB

  Public Sub New(ByVal obj As ObjectB)

    _obj = obj

  End Sub

  Public Sub RunB()

    _obj.Run()

  End Sub

End Class
</pre>
<p> </p>
<pre class="brush: vb;">
Public Class ObjectB

  Public Sub Run()

    Console.WriteLine(&quot;Run from objectB&quot;)

  End Sub

End Class
</pre>
<p><strong>A Loosely Coupled Relationship</strong><br />
Now, let&#8217;s look at a better approach that will allow us to replace ObjectB with another class using the same interface or replace it with a child class of ObjectB.</p>
<p>Below, the ObjectB class now implements the IObjectB interface and the references to ObjectB in ObjectA have been replaced with a reference to the interface IObjectB instead.</p>
<pre class="brush: vb;">
Public Interface IObjectB

  Sub Run()

End Interface
</pre>
<pre class="brush: vb;">
Public Class ObjectA

  Private _obj As IObjectB

  Public Sub New(ByVal obj As IObjectB)

    _obj = obj

  End Sub

  Public Sub RunB()

    _obj.Run()

  End Sub

End Class
</pre>
<pre class="brush: vb;">
Public Class ObjectB
  Implements IObjectB

  Public Sub Run() Implements IObjectB.Run

    Console.WriteLine(&quot;Run from objectB&quot;)

  End Sub

End Class
</pre>
<p>Now, ObjectA can execute no matter if we pass into it a copy of ObjectB or another class that implements the IObjectB interface. The Interface ensures that all objects that implement it will have a subroutine called Run. That is all that ObjectA needs to know. This breaks ObjectA&#8217;s dependency on ObjectB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmjackson.net/2010/01/27/dependency-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SOLID Programming Principles</title>
		<link>http://www.cmjackson.net/2009/09/04/solid-programming-principles/</link>
		<comments>http://www.cmjackson.net/2009/09/04/solid-programming-principles/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 14:33:20 +0000</pubDate>
		<dc:creator>Chris Jackson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[Principles]]></category>
		<category><![CDATA[Reuseable Code]]></category>

		<guid isPermaLink="false">http://www.cmjackson.net/?p=253</guid>
		<description><![CDATA[The SOLID Principles of programming are a good set of rules to follow when you are designing and developing an object oriented application. S  Single Responsiblity Principle &#8211; A class should do one thing and do it well. If you can think of more than one reason to change a class, then it has more than [...]]]></description>
			<content:encoded><![CDATA[<p>The SOLID Principles of programming are a good set of rules to follow when you are designing and developing an object oriented application.</p>
<h2><span style="color: #ff0000;">S</span></h2>
<p><a href="http://fohjin.blogspot.com/2008/04/srp-single-responsibility-principle.html"> <span style="text-decoration: underline;">Single Responsiblity Principle</span></a> &#8211; A class should do one thing and do it well. If you can think of more than one reason to change a class, then it has more than one responsibility.</p>
<h2><span style="color: #ff0000;">O</span></h2>
<p><span style="text-decoration: underline;"><a href="http://www.eventhelix.com/RealtimeMantra/Object_Oriented/open_closed_principle.htm">Open / Closed Principle</a></span> &#8211; A class should be open for extension but closed for modification. Classes should be designed so they can be inherited from without having to modify them.</p>
<h2><span style="color: #ff0000;">L</span></h2>
<p><a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/03/11/ptom-the-liskov-substitution-principle.aspx">Liskov Substitution Principle</a> &#8211; Derived classes must be substitutable for their base class. When a class method accepts an object, the method should be able to accept children of that object without knowing anything about the children.</p>
<h2><span style="color: #ff0000;">I</span></h2>
<p><a href="http://www.oodesign.com/interface-segregation-principle.html">Interface Segregation Principle</a> &#8211; Interfaces should be fine grained and only provide for your needs. When building your interfaces, you should not add more functionality than what you need at the time.</p>
<h2><span style="color: #ff0000;">D</span></h2>
<p><a href="http://www.oodesign.com/dependency-inversion-principle.html">Dependency Inversion Principle</a> &#8211; High level modules should not depend on low level modules, but instead both should depend on abstractions. Interfaces should be used as placeholders and factory classes should be used to instantiate objects. This causes loose coupling between classes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmjackson.net/2009/09/04/solid-programming-principles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Understanding Polymorphism</title>
		<link>http://www.cmjackson.net/2009/06/30/understanding-polymorphism/</link>
		<comments>http://www.cmjackson.net/2009/06/30/understanding-polymorphism/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 23:34:50 +0000</pubDate>
		<dc:creator>Chris Jackson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Interface]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[Polymorphism]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.cmjackson.net/?p=236</guid>
		<description><![CDATA[Introduction This article will explain what polymorphism is and how it can help you design and reuse code in Object-Oriented Programming.  You&#8217;ll learn what polymorphism is and how to use it.  In the following examples, I&#8217;ll be using Visual Basic .NET, but any language that supports Object-Oriented Programming should be able to use these same [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This article will explain what polymorphism is and how it can help you design and reuse code in Object-Oriented Programming.  You&#8217;ll learn what polymorphism is and how to use it.  In the following examples, I&#8217;ll be using Visual Basic .NET, but any language that supports Object-Oriented Programming should be able to use these same techniques.</p>
<p>If you have not already read the articles on <a href="http://www.cmjackson.net/2009/06/22/understanding-objects/">Understanding Objects</a> and <a href="http://www.cmjackson.net/2009/06/26/understanding-inheritance/">Understanding Inheritance</a>, please check them out as some of the terms and other information explained there will be used in this article.</p>
<h2>What is Polymorphism?</h2>
<p>According to <a href="http://dictionary.reference.com/browse/polymorphism">dictionary.com</a>, the definition of Polymorphism is as follows:</p>
<blockquote><p>3. <em>Biology</em> The occurrence of different forms, stages, or types in individual organisms or in organisms of the same species, independent of sexual variations.</p></blockquote>
<p>So, how does this relate to programming?  We&#8217;ll develop Objects that have different forms of the same <em>&#8220;species&#8221;</em>.  The great thing about Polymorphism is that when you are building your program, you assume you are working with the <em>&#8220;species&#8221;</em> Object, but you actually use an individual <em>&#8220;organism&#8221;</em> Object.  This allows the <em>&#8220;organism&#8221;</em> Objects to be exchanged in the code for one another.</p>
<p>In other words, say we have a Parent Class called Animal and two Child Classes that Inherit from Animal called Cat and Dog.  The Cat and Dog are both Animals, so they will inherit all the properties and methods that an Animal has.  If we wanted to store an array of Cats or Dogs, we could just declare the array to be of type Animal and then we&#8217;d be able to store either Cats or Dogs within the array.  That is Polymorphism.</p>
<h2>Parent Classes and Interfaces</h2>
<p>Both Parent Classes and Interfaces can be used to setup an Object as the <em>&#8220;species&#8221;</em> level.  Parent Classes have been explained in <a href="http://www.cmjackson.net/2009/06/26/understanding-inheritance/">Understanding Inheritance</a>.</p>
<h2>What is an Interface?</h2>
<p>An Object&#8217;s Interface is how you communicate or interact with that Object.  Interfaces in programming terms are similar to a Class Object, but an Interface does not implement the properties or methods it declares, it simply declares them.</p>
<p>Why is this useful?  Interfaces force the Class Objects that implement the Interface to have all of the properties and methods of the Interface.  So, the following IAnimal Interface could be implemented by Cat and Dog to force them to implement the properties, Height and Weight, along with the methods, Eat and Drink.</p>
<pre class="brush: vb;">Public Interface IAnimal

    Property Height() As Integer
    Property Weight() As Integer

    Function Eat(footType As String) As Boolean
    Function Drink(drinkType As String) As Boolean

End Interface</pre>
<p>Interfaces can be used with Parent or Child classes and multiple Interfaces can be used by one Class.  Also, in some cases, you may want to use an Interface in place of a Parent Class, forcing all properties and methods to be fully implemented in each class.  Another thing to keep in mind is that a Parent Class that implements the IAnimal Interface does not have to fully implement all properties and methods.  Instead, the Parent Class could implement those common properties or methods that will not change no matter the Child Class, and leave the others to be implemented by the Child Class.  In VB.NET, you can use the MustOverride keyword on the function declaration.  This will make the Parent Class an Abstract class.</p>
<pre class="brush: vb;">Public MustInherit Class Animal Implements IAnimal

    'Data Members.
    Private _height As Integer
    Private _weight As Integer

    Public Property Height() As Integer Implements IAnimal.Height
        Get
            return _height
        End Get
        Set(ByVal Value As Integer)
            _height = value
        End Set
    End Property

    Public Property Weight() As Integer Implements IAnimal.Weight
        Get
            Return _weight
        End Get
        Set(ByVal Value As Integer)
            _weight = Value
        End Set
    End Property

    'Abstract Functions.
    Public MustOverride Function Eat(foodType As String) As Boolean Implements IAnimal.Eat
    Public MustOverride Function Drink(drinkType As String) As Boolean Implements IAnimal.Drink

End Class</pre>
<p> Now, things are looking pretty good.  We can force are Classes to implement certain properties and methods, but there is still one downside.  Our methods are passing in a String value for foodType and drinkType.  What if we wanted to use a different data type, such as our own Object that holds other properties for foodType?  We don&#8217;t want to have to modify the Interface or Parent Class each time this may change.  What we want to do is make the Class or Interface Generic.</p>
<h2>How do I make my Interface or Class Generic?</h2>
<p>Making a Class or Interface Generic will make your code more reusable.  When you make a Class or Interface Generic, you don&#8217;t have to know what type of data you will be using with the Object until you declare or create an instance of the Object.  So, various programs could use the same Class Object, but passing in different data types to work with when instantiating the Object. </p>
<pre class="brush: vb;">Public Interface IAnimal(Of T)

    Property Height() As Integer
    Property Weight() As Integer

    Function Eat(foodType As T) As Boolean
    Function Drink(drinkType As T) As Boolean

End Interface</pre>
<p>T is a place holder for the type of data we will declare later on.  Notice in the declaration of the Interface and both methods, Eat and Drink, T is used.  Now, when we create a Cat or Dog using the IAnimal Interface, we can determine what type of data will be used for foodType and drinkType.</p>
<pre class="brush: vb;">Public Class Cat Implements IAnimal(Of String)</pre>
<p>This would declare a Cat to use a String data type to store the foodType and drinkType.</p>
<pre class="brush: vb;">Public Class Dog Implements IAnimal(Of Integer)</pre>
<p>And this one would declare a Dog to use an Integer data type to store the foodType and drinkType.</p>
<p>We could also define our own complex Class Object as the data type.</p>
<h2>Advantages of using Polymorphism, Interfaces, and Generic Objects</h2>
<ul>
<li>Polymorphism allows you to use similar types of data together.  It also can be used to improve system maintenance, reuse code, and easily setup testing Objects that mimic communications with databases and other resources.</li>
<li>Interfaces force the implementation of properties and methods on Objects that implement the Interface.</li>
<li>Generic Objects allow more reusable code when building Class Objects and Interfaces.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cmjackson.net/2009/06/30/understanding-polymorphism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Inheritance</title>
		<link>http://www.cmjackson.net/2009/06/26/understanding-inheritance/</link>
		<comments>http://www.cmjackson.net/2009/06/26/understanding-inheritance/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:18:55 +0000</pubDate>
		<dc:creator>Chris Jackson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Abstraction]]></category>
		<category><![CDATA[Inheritance]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.cmjackson.net/?p=200</guid>
		<description><![CDATA[Before we get started on the topic of Inheritance, please check out Understanding Objects.  Now, onward&#8230; According to dictionary.com, one definition of inheritance is: 2. the genetic characters transmitted from parent to offspring, taken collectively. This definition also fits with Object Oriented Programming.  Remember, that our Objects mimic those found in real-life and just like [...]]]></description>
			<content:encoded><![CDATA[<p>Before we get started on the topic of Inheritance, please check out <a href="http://www.cmjackson.net/2009/06/22/understanding-objects/">Understanding Objects</a>.  Now, onward&#8230;</p>
<p>According to <a href="http://dictionary.reference.com/browse/inheritance">dictionary.com</a>, one definition of inheritance is:</p>
<blockquote><p>2. the genetic characters transmitted from parent to offspring, taken collectively.</p></blockquote>
<p>This definition also fits with Object Oriented Programming.  Remember, that our Objects mimic those found in real-life and just like in real-life, Objects can have Parent Objects or Children Objects.  Inheritance is the process of obtaining the properties and methods from another Object.  The Child Object inherits these properties and methods from the Parent Object.</p>
<p>Using Inheritance, we can extend the functionality of a Class Object without having to modify that Object.  This helps you make your own code more reusable as well as gives you the ability to improve other people&#8217;s Class Objects.</p>
<h2>Access Modifiers</h2>
<p>I had talked breifly about Access Modifiers in <a href="http://www.cmjackson.net/2009/06/22/understanding-objects/">Understanding Objects</a>.  When building Parent and Child Class Objects, you will most likely be using all three: Private, Public and Protected.</p>
<p>A Child Class that inherits from a Parent does not gain access to all of the Parent&#8217;s properties and methods.  The Parent uses Encapsulation and Data Hiding to protect it&#8217;s Private properties and methods.  The Child Class can only access those properties and methods that are Protected or make up the Public Interface for the Parent Class.</p>
<p>The Protected access modifier acts similar to Private, keeping the properties and methods hidden from outside use, but it will allow Child Class Objects access to them.</p>
<p>Below is an example of a Parent Class:</p>
<pre class="brush: vb;">Public Class MyParent

    Private _hiddenVariable As String
    Private _errors As String

    Public Sub New()

        _hiddenVariable = “”
        _errors = “”

    End Sub

    Protected Sub AddError(error As String)

        _errors += error + VbCrLf

    End Sub

    Public Function GetErrors()

        Return _errors

    End Function

End Class</pre>
<p>Below is an example of a Child Class:</p>
<pre class="brush: vb;">Public Class MyChild
    Inherits MyParent

    Public Sub New()

        MyBase.New()

    End Sub

    Public Function MyNewFunction()

        Return &quot;It Worked!&quot;

    End Function

End Class</pre>
<p>In the above examples, the Parent Class has a couple Private string variables.  The subroutine, AddError, would normally be a Private function, but since we want the Child Class to have access to this function, we must change it to Protected.</p>
<p>There are two methods on MyParent&#8217;s Public Interface: New() and GetErrors().</p>
<p>The MyChild Class uses Inheritance to extend MyParent&#8217;s functionality.  In VB, the Inherits keyword is used to tell which class is the Parent.  Within MyChild, all of the functions on the Public Interface for MyParent as well as the Protected function, AddError, can be accessed.</p>
<p>There are three methods on MyChild&#8217;s Public Interface: New(), GetErrors(), and MyNewFunction().</p>
<h2>Overriding Methods</h2>
<p>When developing a Child Class, you may find that you need to change the way that one of the Parent Class&#8217; methods work.  To do this, you must override the method in the Child Class.  When an instance of the Child Class is used, the overridden function would be used within the Child Class instead of the Parent Class.</p>
<p>Some languages allow you to override the function by simply declaring the same function in the Child as in the Parent.  In VB, you would use the Overrides keyword to declare you are overriding a function.</p>
<pre class="brush: vb;">Protected Overrides Sub AddError(error As String)

    _errors += &quot;MyChild:&quot; + error + VbCrLf

End Sub</pre>
<p>This subroutine would be placed in the MyChild Class and would override the AddError subroutine found in the MyParent Class.  Errors that occur in the Child Class would show &#8220;MyChild:&#8221; in front of them.</p>
<p>Also, the Child method that overrides the Parent, can also call the Parent&#8217;s method.  This allows you the power of performing some small change without having to re-implement the entire method in the Child Class.  In VB, you would use the MyBase keyword to signal you are looking for the Parent Class version of the method.</p>
<pre class="brush: vb;">MyBase.AddError(&quot;my error&quot;)</pre>
<h2>Abstraction</h2>
<p>Abstraction is the process of declaring a Class, property or method without giving the details on the implementation of that element.  A Parent Class can use Abstraction to declare that a function must be present in any Child Class of that Parent.  The Child Class can then either define what the method does or declare the method as Abstract also.</p>
<p>If a Class is Abstract, then an instance of that Class can not be created.  You must instead, access the Class through one of it&#8217;s children. </p>
<p>In VB, you can force a Class to be Abstract by using the MustInherit keyword.</p>
<pre class="brush: vb;">Public MustInherit Class MyParent</pre>
<p>Below is an example of the MyParent Class if we wanted to make the AddError function Abstract. </p>
<pre class="brush: vb;">Public Class MyParent

    Private _hiddenVariable As String
    Private _errors As String

    Public Sub New()

        _hiddenVariable = “”
        _errors = “”

    End Sub

    Protected MustOverride Sub AddError(error As String)

    Public Function GetErrors()

        Return _errors

    End Function

End Class</pre>
<h2>Advantages of Inheritance, Abstraction, and Overriding Methods</h2>
<ul>
<li>Inheritance helps you extend the functionality of your own classes or other people&#8217;s classes.</li>
<li>Abstraction can be useful if you need multiple Classes that have similar properties and methods.  You can create an Abstract Parent Class with the common properties and methods and have the Children Classes hold the unique properties and methods.</li>
<li>Overriding Methods allows you to change the functionality of a Parent Class without modifying the Parent&#8217;s code.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cmjackson.net/2009/06/26/understanding-inheritance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding Objects</title>
		<link>http://www.cmjackson.net/2009/06/22/understanding-objects/</link>
		<comments>http://www.cmjackson.net/2009/06/22/understanding-objects/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 13:42:12 +0000</pubDate>
		<dc:creator>Chris Jackson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://www.cmjackson.net/?p=132</guid>
		<description><![CDATA[Objects are all around us; the monitor your looking at, your IPod, your cat or dog, etc.  Programming objects mimic those found in real life.  When you use an object, like an IPod, there are certain things you can do with it.  The object has an Interface, or way for you to interact with the [...]]]></description>
			<content:encoded><![CDATA[<p>Objects are all around us; the monitor your looking at, your IPod, your cat or dog, etc.  Programming objects mimic those found in real life.  When you use an object, like an IPod, there are certain things you can do with it.  The object has an Interface, or way for you to interact with the object.  The object also has properties that work internally that you do not have direct access to, such as the current song playing, the next song to play, the current play position, etc. </p>
<p>Programming Objects store the state of an Object in internal variables and has methods that are used to access that information.</p>
<h2>Access Modifiers</h2>
<p>Access modifiers let you set the access level of class properties or functions.</p>
<ul>
<li><strong>Private</strong> &#8211; Only this class&#8217; functions can use the item.</li>
<li><strong>Public</strong> &#8211; This class&#8217; functions and any outside source can use the item.</li>
<li><strong>Protected</strong> &#8211; This class or any Child Class can use the item.</li>
</ul>
<h2>Encapsulation</h2>
<p><img class="alignright size-full wp-image-133" title="ObjectDiagram" src="http://www.cmjackson.net/wp-content/uploads/2009/06/ObjectDiagram.jpg" alt="ObjectDiagram" width="300" height="300" />In Object-Oriented Programming, your Class files have internal data members, or variables.  These variables hold properties of the Object.  By setting your Class variables to Private or Protected, you ensure that anyone using your Class cannot access the data directly.  If the variable needs to be accessed outside the Class, then Get or Set functions can be setup to allow access.  This ensures that your Class&#8217; data cannot be changed without your knowledge.  This is called Encapsulation and allows for Data Hiding.</p>
<p>Imagine a radio Object in the example on the right-side where the two Class variables (in green) are Encapsulated in the object and surrounded by the Public Interface (in blue) to those variables.</p>
<p>One of the benefits of using Get and Set functions to access your Class variables is that you can do some validation to make sure the data is valid before storing it.</p>
<h2>Public Interface</h2>
<p>Each object, or Class file, you create will have a Public Interface that allows your program, or other classes, to communicate with it.  By using the Public access modifier, you allow anyone who creates an instance of your Class to access that Class variable or function.</p>
<h2>Advantages of Object Oriented Programming</h2>
<ul>
<li>OOP creates a natural structure to your code mimicking real-world examples we can see.</li>
<li>Code that deals with an Object is grouped together making it easier to reuse and maintain.</li>
<li>Encapsulation allows for greater control over what variables can store.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cmjackson.net/2009/06/22/understanding-objects/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

