





<?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>Durofy &#187; classes</title>
	<atom:link href="http://www.durofy.com/tag/classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.durofy.com</link>
	<description>Engineering &#38; Technology Blog</description>
	<lastBuildDate>Sun, 05 Feb 2012 04:41:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Understanding Inheritance in OOP</title>
		<link>http://www.durofy.com/programming/understanding-inheritance-in-oop/</link>
		<comments>http://www.durofy.com/programming/understanding-inheritance-in-oop/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 06:45:56 +0000</pubDate>
		<dc:creator>Rishabh Dev</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[c sample program]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[c++ inheritance]]></category>
		<category><![CDATA[c++ programming]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[derived classes oop]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[inheritance c++]]></category>
		<category><![CDATA[inheritance concept]]></category>
		<category><![CDATA[object-oriented programming]]></category>
		<category><![CDATA[oop inheritance]]></category>

		<guid isPermaLink="false">http://zarrata.com/durofy/?p=168</guid>
		<description><![CDATA[The example below explains inheritance, an important property of OOP languages. We have three classes: living, animal &#38; dog. The dog inherits all the characteristics of living &#38; animal base classes however, the plant does not(being an instance of just the living class). #include&#60;iostream&#62; using namespace std; class living { int energy; public: void getenergy() [...]]]></description>
			<content:encoded><![CDATA[<p>The example below explains inheritance, an important property of OOP languages.</p>
<p>We have three classes: living, animal &amp; dog. The dog inherits all the characteristics of living &amp; animal base classes however, the plant does not(being an instance of just the living class).</p>
<pre>#include<span style="color: blue; font-size: xx-small;">&lt;</span>iostream<span style="color: blue; font-size: xx-small;">&gt;</span>
using namespace std<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
<span style="color: red;"><strong>class</strong></span> living
<span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
      <span style="color: red;"><strong>int</strong></span> energy<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
      <span style="color: red;"><strong>public</strong></span><span style="color: blue; font-size: xx-small;">:</span>
                <span style="color: red;"><strong>void</strong></span> getenergy<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span>
                <span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
                     cout<span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: purple;">"Gets energy"</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span>endl<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
                     <span style="color: blue; font-size: xx-small;"><strong>}</strong></span>
<span style="color: blue; font-size: xx-small;"><strong>}</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
<span style="color: red;"><strong>class</strong></span> animal<span style="color: blue; font-size: xx-small;">:</span><span style="color: red;"><strong>public</strong></span> living
<span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
      <span style="color: red;"><strong>int</strong></span> feet<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
      <span style="color: red;"><strong>public</strong></span><span style="color: blue; font-size: xx-small;">:</span>
                <span style="color: red;"><strong>void</strong></span> move<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span>
                <span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
                     cout<span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: purple;">"It moves"</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span>endl<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
                     <span style="color: blue; font-size: xx-small;"><strong>}</strong></span>
<span style="color: blue; font-size: xx-small;"><strong>}</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
<span style="color: red;"><strong>class</strong></span> dog<span style="color: blue; font-size: xx-small;">:</span><span style="color: red;"><strong>public</strong></span> animal
<span style="color: blue; font-size: xx-small;"><strong>{</strong></span>

      <span style="color: red;"><strong>int</strong></span> tail<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
      <span style="color: red;"><strong>public</strong></span><span style="color: blue; font-size: xx-small;">:</span>
                <span style="color: red;"><strong>void</strong></span> bark<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span>
                <span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
                     cout<span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: purple;">"It barks"</span><span style="color: blue; font-size: xx-small;">&lt;</span><span style="color: blue; font-size: xx-small;">&lt;</span>endl<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
                     <span style="color: blue; font-size: xx-small;"><strong>}</strong></span>
<span style="color: blue; font-size: xx-small;"><strong>}</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
<span style="color: red;"><strong>int</strong></span> <span style="color: red;"><strong>main</strong></span><span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span>
<span style="color: blue; font-size: xx-small;"><strong>{</strong></span>
    living plant<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
    plant<span style="color: blue; font-size: xx-small;"><strong>.</strong></span>getenergy<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>

    dog phoenix<span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
    phoenix<span style="color: blue; font-size: xx-small;"><strong>.</strong></span>getenergy<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
    phoenix<span style="color: blue; font-size: xx-small;"><strong>.</strong></span>move<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
    phoenix<span style="color: blue; font-size: xx-small;"><strong>.</strong></span>bark<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>

    system<span style="color: blue; font-size: xx-small;"><strong>(</strong></span><span style="color: purple;">"pause"</span><span style="color: blue; font-size: xx-small;"><strong>)</strong></span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
    <span style="color: red;"><strong>return</strong></span> <span style="color: #a52a2a;">0</span><span style="color: blue; font-size: xx-small;"><strong>;</strong></span>
<span style="color: blue; font-size: xx-small;"><strong>}</strong></span></pre>
<p>The dog inherits the properties of animal which inherits the properties of living. Hence, this inheritance is an example of "Multi-level" inheritance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.durofy.com/programming/understanding-inheritance-in-oop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Basics Of Object Oriented Programming</title>
		<link>http://www.durofy.com/programming/the-basics-of-object-oriented-programming/</link>
		<comments>http://www.durofy.com/programming/the-basics-of-object-oriented-programming/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 15:56:11 +0000</pubDate>
		<dc:creator>Rishabh Dev</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[abstraction data]]></category>
		<category><![CDATA[basics oop]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[encapsulation]]></category>
		<category><![CDATA[fundamental of oop]]></category>
		<category><![CDATA[information hiding]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[object oriented paradigm]]></category>
		<category><![CDATA[object-oriented programming]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[polymorphism]]></category>

		<guid isPermaLink="false">http://zarrata.com/durofy/?p=49</guid>
		<description><![CDATA[As I pointed out in my previous post, we use classes in Object Oriented Programming(OOP) which are a blueprint of objects that share common properties. This use of classes &#038; more precisely, of objects makes the process of programming easy &#038; efficient. That was exactly the reason why the Object Oriented Programming Paradigm was introduced. [...]]]></description>
			<content:encoded><![CDATA[<p>As I pointed out in my <a href="http://zarrata.com/durofy/programming/c-as-a-multi-paradigm-programming-language/">previous post</a>, we use classes in Object Oriented Programming(OOP) which are a blueprint of objects that share common properties. This use of classes &#038; more precisely, of objects makes the process of programming easy &#038; efficient.</p>
<p>That was exactly the reason why the Object Oriented Programming Paradigm was introduced. Now, there are certain fundamental features that you would find in every object oriented programming language.</p>
<p><img src="http://i28.tinypic.com/zvwgif.jpg"></p>
<p>Lets now take a look at each of them individually,<br />
Lets take up CLASSES first. They consists of entities called objects-or they are blueprints of objects.</p>
<p>For example, a car would be a class &#038; a van would be an object that belongs to the class called cars. Now, once we know the behavior of this object, we can use it anywhere we need in the program without having to define the behavior/properties again &#038; again, which is the basic aim of OOP.</p>
<p>The objects here act as building blocks of the program. Though the objects can differ in terms of specific attributes(like a van could be red or blue), the classes would only depict the common behavior of all objects(like each car would have 4 wheels, turn left, right &#038; so on...)</p>
<p>Now, the basic features of OOP...</p>
<p>A) <strong><font color="green">Polymorphism</font></strong> - It simply implies "something having various forms".<br />
In the OOP world, this is evident with variables &#038; functions.(and hence, with objects as well)</p>
<p>For instance, A variable called <strong>MEMBERID</strong> could take a name or a number &#038; the program would recognize &#038; accept both.</p>
<p>Another example is the "<strong>+</strong>" sign which can denote the mathematical operation, or strings or lists.</p>
<p>B) <strong><font color="green">Inheritance</font></strong> - It is simply forming new classes(derived classes) from previously existing ones(base classes). In the process, the derived classes inherit certain properties of the base classes.</p>
<p>The concept is similar to how children inherit certain features from their parents, hence, the base classes are also sometimes refereed to as ancestor classes.</p>
<p>In terms of relationships, we call the relation between the base &#038; derived class the <em>as-is</em> relationship. Consider the base class "car" &#038; the derived class "bmw". Then we can say "bmw" <em>is-a</em> "car" which is generalized to "derived class" <em>is-a</em> "base class".</p>
<p>Encapsulation, Data Abstraction &#038; Information hiding are very similar concepts &#038; people often confuse them to be the same.</p>
<p>In one single statement, <strong><font color="blue">Abstraction</font></strong> is a technique that lets us know what information should be visible, and what information should be hidden. <strong><font color="blue">Encapsulation</font></strong> is the technique to display the information in a way as to hide what should be hidden, and show what's needed.<br />
Then, <strong><font color="blue">Information Hiding</font></strong> is the process of hiding all the inessential details of an object.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.durofy.com/programming/the-basics-of-object-oriented-programming/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

