<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to inherit classes in javascript</title>
	<atom:link href="http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-inherit-classes-in-javascript</link>
	<description>helping you with javascript since 2007</description>
	<lastBuildDate>Tue, 31 Jan 2012 11:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: check this</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1436</link>
		<dc:creator>check this</dc:creator>
		<pubDate>Sat, 28 Jan 2012 08:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1436</guid>
		<description>&lt;strong&gt;Awesome website...&lt;/strong&gt;

[...]the time to read or visit the content or sites we have linked to below the[...]…...</description>
		<content:encoded><![CDATA[<p><strong>Awesome website&#8230;</strong></p>
<p>[...]the time to read or visit the content or sites we have linked to below the[...]…&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe_bolla</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1432</link>
		<dc:creator>Joe_bolla</dc:creator>
		<pubDate>Sun, 08 Jan 2012 21:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1432</guid>
		<description>Here is a simple way to implement inheritance in Javascript:
Person = function(id, name, age){    this.id = id;    this.name = name;    this.age = age;    alert(&#039;A new person has been accepted&#039;);}Person.prototype = {    /** wake person up */    wake_up: function() {        alert(&#039;I am awake&#039;);    },    /** retrieve person&#039;s age */    get_age: function() {        return this.age;    }}Inheritance_Manager = {};Inheritance_Manager.extend = function(subClass, baseClass) {    function inheritance() { }    inheritance.prototype = baseClass.prototype;    subClass.prototype = new inheritance();    subClass.prototype.constructor = subClass;    subClass.baseConstructor = baseClass;    subClass.superClass = baseClass.prototype;}Manager = function(id, name, age, salary) {    Manager.baseConstructor.call(this, id, name, age);    this.salary = salary;    alert(&#039;A manager has been registered.&#039;);}Inheritance_Manager.extend(Manager, Person);Manager.prototype.lead = function(){   alert(&#039;I am a good leader&#039;);}var p = new Person(1, &#039;Joe Tester&#039;, 26);var pm = new Manager(1, &#039;Joe Tester&#039;, 26, &#039;20.000&#039;);

alert(p.name);alert(pm.salary);View all code here with demos:
http://www.cyberminds.co.uk/blog/articles/how-to-implement-javascript-inheritance.asp





</description>
		<content:encoded><![CDATA[<p>Here is a simple way to implement inheritance in Javascript:<br />
Person = function(id, name, age){    this.id = id;    this.name = name;    this.age = age;    alert(&#8216;A new person has been accepted&#8217;);}Person.prototype = {    /** wake person up */    wake_up: function() {        alert(&#8216;I am awake&#8217;);    },    /** retrieve person&#8217;s age */    get_age: function() {        return this.age;    }}Inheritance_Manager = {};Inheritance_Manager.extend = function(subClass, baseClass) {    function inheritance() { }    inheritance.prototype = baseClass.prototype;    subClass.prototype = new inheritance();    subClass.prototype.constructor = subClass;    subClass.baseConstructor = baseClass;    subClass.superClass = baseClass.prototype;}Manager = function(id, name, age, salary) {    Manager.baseConstructor.call(this, id, name, age);    this.salary = salary;    alert(&#8216;A manager has been registered.&#8217;);}Inheritance_Manager.extend(Manager, Person);Manager.prototype.lead = function(){   alert(&#8216;I am a good leader&#8217;);}var p = new Person(1, &#8216;Joe Tester&#8217;, 26);var pm = new Manager(1, &#8216;Joe Tester&#8217;, 26, &#8217;20.000&#8242;);</p>
<p>alert(p.name);alert(pm.salary);View all code here with demos:<br />
<a href="http://www.cyberminds.co.uk/blog/articles/how-to-implement-javascript-inheritance.asp" rel="nofollow">http://www.cyberminds.co.uk/blog/articles/how-to-implement-javascript-inheritance.asp</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe_bolla</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1430</link>
		<dc:creator>Joe_bolla</dc:creator>
		<pubDate>Wed, 21 Dec 2011 21:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1430</guid>
		<description>Try this simple example http://www.cyberminds.co.uk/blog/articles/how-to-implement-javascript-inheritance.aspx
</description>
		<content:encoded><![CDATA[<p>Try this simple example http://www.cyberminds.co.uk/blog/articles/how-to-implement-javascript-inheritance.aspx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dsimard</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1410</link>
		<dc:creator>dsimard</dc:creator>
		<pubDate>Fri, 14 Oct 2011 15:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1410</guid>
		<description>I don&#039;t think you can do it.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think you can do it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Viktor Eriksson</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1409</link>
		<dc:creator>Viktor Eriksson</dc:creator>
		<pubDate>Fri, 14 Oct 2011 15:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1409</guid>
		<description>How do I inherit new Document() ?
Only get error.</description>
		<content:encoded><![CDATA[<p>How do I inherit new Document() ?<br />
Only get error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Parminavilum</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1379</link>
		<dc:creator>Parminavilum</dc:creator>
		<pubDate>Thu, 13 Oct 2011 02:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1379</guid>
		<description>&lt;strong&gt;Awesome website...&lt;/strong&gt;

[...]the time to read or visit the content or sites we have linked to below the[...]…...</description>
		<content:encoded><![CDATA[<p><strong>Awesome website&#8230;</strong></p>
<p>[...]the time to read or visit the content or sites we have linked to below the[...]…&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nasr</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1225</link>
		<dc:creator>Nasr</dc:creator>
		<pubDate>Mon, 01 Aug 2011 14:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1225</guid>
		<description>I&#039;ve tried  this code but alert(cat2.x) resulted 1 not 2, am i missing something?</description>
		<content:encoded><![CDATA[<p>I&#39;ve tried  this code but alert(cat2.x) resulted 1 not 2, am i missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric B.</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1211</link>
		<dc:creator>Eric B.</dc:creator>
		<pubDate>Wed, 06 Jul 2011 07:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1211</guid>
		<description>Look at my post</description>
		<content:encoded><![CDATA[<p>Look at my post</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric B.</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1210</link>
		<dc:creator>Eric B.</dc:creator>
		<pubDate>Wed, 06 Jul 2011 07:08:42 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1210</guid>
		<description>Look at my post</description>
		<content:encoded><![CDATA[<p>Look at my post</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric B.</title>
		<link>http://www.javascriptkata.com/2007/05/22/how-to-inherit-classes-in-javascript/comment-page-1/#comment-1209</link>
		<dc:creator>Eric B.</dc:creator>
		<pubDate>Wed, 06 Jul 2011 07:07:19 +0000</pubDate>
		<guid isPermaLink="false">http://javascriptkata.timmyontime.com/?p=41#comment-1209</guid>
		<description>The above code works fine as long as you inherit a whole class with its own methods and member data. Lecastordesneiges is making member data &quot;static&quot; across all classes so the subclasses will see the reference to the super classes &quot;static&quot; member. Making &quot;x&quot; a literal and not instantiating a &quot;new&quot; x will result in accessing the same memory slot. You must &quot;mammal.prototype = new some_beast();&quot; so the subclass can inherit as a general base. Re-read what the man posted.</description>
		<content:encoded><![CDATA[<p>The above code works fine as long as you inherit a whole class with its own methods and member data. Lecastordesneiges is making member data &#8220;static&#8221; across all classes so the subclasses will see the reference to the super classes &#8220;static&#8221; member. Making &#8220;x&#8221; a literal and not instantiating a &#8220;new&#8221; x will result in accessing the same memory slot. You must &#8220;mammal.prototype = new some_beast();&#8221; so the subclass can inherit as a general base. Re-read what the man posted.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

